From patchwork Mon Sep 4 22:04:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4985 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.15.201 with SMTP id 70csp3508229jao; Mon, 4 Sep 2017 15:04:26 -0700 (PDT) X-Google-Smtp-Source: ADKCNb482sAHqhGXnMKlACopfmfjq2Kw5dwrVGllzp7jvFpL9k7801hG9Rr2gp4T5yGDdYhP68ot X-Received: by 10.28.208.205 with SMTP id h196mr583497wmg.1.1504562666322; Mon, 04 Sep 2017 15:04:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504562666; cv=none; d=google.com; s=arc-20160816; b=j7irCOVFZn62/e94FpipJB8tmmPbbJPNU98xDH07VfoSZdWv+NdoAAv0i/d2q4dxvQ ge/s4uJD6eldohn4BIYftYeruN8SACuPRam4mt5V8ZVjCLSq9f1n8KLuPgNpBqSYx06U T6vNH7V4PIF5xhFNjUCBvYnW0Su165jBoELIBFt4cr7BGiYyB1S4cGCh3YsmZuQvm1Dc FqhYhi4GN4ZJ9e+ysT3hVu0twd6G7IKxgp/k+BznAs0eWcn5g+WuYfDeV+d1+zTAeS3p EG/ffY6Ilhzx2Q5o9qBgINgHSB1L+wNUKflR19LiWpGSo+Iew7NVCebTOyEtWDxlqAxs 5GhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=O2iohHlGy3wCaOOIhGF6q4hxpr6vd2n5AsrYha+g81I=; b=UbO08Y2/l7GmFGo9MY90b4qQ5zuJJCkgCy91phlWvb3wgdN55twnoSXUQPZueHCjE6 0oO0gYeuPnQgleodJBqfmLuWL6sbDhhMQm+YBLbVbwNc6SJPCVZbVjmEr+WUkHJJG2rf 97oWh6mwz/dto1DSbdXkGFbVxELv6y/EdUj8xM79No6qDlFLignry27Nd00BVdq/03lC XikLVFmBykrqgvcKQtqGFWIEW8qQD0Dv+wCazvyvZNeWjRAYdetfJ99gzpxN0uVVKkJR gcgMK+POOfZnS5XOl/kymFQdC2DtpVqtAspL13Bski/V69LXfrNraDGYvUMPfyV15LXy 370A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 125si5791531wml.116.2017.09.04.15.04.25; Mon, 04 Sep 2017 15:04:26 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2475C68A335; Tue, 5 Sep 2017 01:04:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-3.mx.upcmail.net (vie01a-qmta-pe02-3.mx.upcmail.net [62.179.121.183]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0499368A135 for ; Tue, 5 Sep 2017 01:04:15 +0300 (EEST) Received: from [172.31.218.49] (helo=vie01a-dmta-pe05-1.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dozTd-0005nJ-BS for ffmpeg-devel@ffmpeg.org; Tue, 05 Sep 2017 00:04:17 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dozTX-0006BG-LA for ffmpeg-devel@ffmpeg.org; Tue, 05 Sep 2017 00:04:11 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 5a491w0150S5wYM01a4AME; Tue, 05 Sep 2017 00:04:10 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 5 Sep 2017 00:04:08 +0200 Message-Id: <20170904220408.27284-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.1 Subject: [FFmpeg-devel] [PATCH] avcodec/jpeg2000: Check that codsty->log2_prec_widths/heights has been initialized X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: OOM Fixes: 2225/clusterfuzz-testcase-minimized-5505632079708160 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/jpeg2000.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c index 94efc94c4d..9e1bbc2ec4 100644 --- a/libavcodec/jpeg2000.c +++ b/libavcodec/jpeg2000.c @@ -506,6 +506,10 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, // update precincts size: 2^n value reslevel->log2_prec_width = codsty->log2_prec_widths[reslevelno]; reslevel->log2_prec_height = codsty->log2_prec_heights[reslevelno]; + if (!reslevel->log2_prec_width || !reslevel->log2_prec_height) { + av_log(avctx, AV_LOG_ERROR, "COD/COC is missing\n"); + return AVERROR_INVALIDDATA; + } /* Number of bands for each resolution level */ if (reslevelno == 0)