From patchwork Thu Aug 22 18:09:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 14656 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 4065B447327 for ; Thu, 22 Aug 2019 21:11:31 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0B6C868ABD5; Thu, 22 Aug 2019 21:11:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-2.mx.upcmail.net (vie01a-dmta-pe07-2.mx.upcmail.net [84.116.36.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BA02F68A3BF for ; Thu, 22 Aug 2019 21:11:24 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1i0rYS-00045Q-1u for ffmpeg-devel@ffmpeg.org; Thu, 22 Aug 2019 20:11:24 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 0rXTiwS67wlys0rXTidzGb; Thu, 22 Aug 2019 20:10:24 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.41.20 X-CNFS-Analysis: v=2.3 cv=E5OzWpVl c=1 sm=1 tr=0 a=I1eytVlZLDX1BM2VTtTtSw==:117 a=I1eytVlZLDX1BM2VTtTtSw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=36V606bdL3_KwSilgfQA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 22 Aug 2019 20:09:23 +0200 Message-Id: <20190822180925.12233-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfBZb6n0tNqKPZp+r/bbRE3ASL639wDzxTwnuFjBQDnX1oBVqb343/RuIGiqxi8hxpw2zHCAJqeM6IBJI2DtgIn8SbNrYpNrFCkx90tog+MamT/F6tKTE nsWMOOVBlbPKQgaJ/mCreP4ZTdQpV7F1P+2XXjcjNWb1Sg4SAkITNZHQ Subject: [FFmpeg-devel] [PATCH 1/3] tools/target_dec_fuzzer: Do not increase max_pixels 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index d83039417c..5119a7c5da 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -180,12 +180,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { } - AVCodecContext* ctx = avcodec_alloc_context3(NULL); + AVCodecContext* ctx = avcodec_alloc_context3(c); AVCodecContext* parser_avctx = avcodec_alloc_context3(NULL); if (!ctx || !parser_avctx) error("Failed memory allocation"); - ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM and hangs + if (ctx->max_pixels == 0 || ctx->max_pixels > maxpixels_per_frame) + ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM and hangs if (size > 1024) { GetByteContext gbc;