From patchwork Wed Jul 31 08:52:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 14168 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 6BE42449F9D for ; Wed, 31 Jul 2019 11:54:11 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 39F0C68A641; Wed, 31 Jul 2019 11:54:11 +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 310CE68A38B for ; Wed, 31 Jul 2019 11:54:05 +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 1hskN2-00009Z-14 for ffmpeg-devel@ffmpeg.org; Wed, 31 Jul 2019 10:54:04 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id skM3heT8c5D5NskM3hXpQC; Wed, 31 Jul 2019 10:53:04 +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=bu8y+3Si 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=uXaULy-vabtEH7yn7PkA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 31 Jul 2019 10:52:32 +0200 Message-Id: <20190731085234.26529-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfJtOfOAb1WdDMqAt2V3qFOI4hp64IGuyjEbYIpMQl1MGCxUpeMydNZF3d+xW+fgg2vktlwgt69HohM9jGQBl98qUktcK3qUO3yAk9eCp8t1BLYGljMxh J0qxturRV6jsHRwpn5+gkpZ1k5j1BS5XMREOyH2Gng00ar4fYlEPS7eB Subject: [FFmpeg-devel] [PATCH 1/3] tools/target_dec_fuzzer: Limit number off all pixels decoded 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" This should reduces the number of uninteresting timeouts encountered Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index 8ba25b4e8a..0c398da95b 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -128,6 +128,8 @@ static void FDBPrepare(FuzzDataBuffer *FDB, AVPacket *dst, const uint8_t *data, // Ensure we don't loop forever const uint32_t maxiteration = 8096; +const uint64_t maxpixels_per_frame = 4096 * 4096; +const uint64_t maxpixels = maxpixels_per_frame * maxiteration / 8; static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL; @@ -171,7 +173,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (!ctx || !parser_avctx) error("Failed memory allocation"); - ctx->max_pixels = 4096 * 4096; //To reduce false positive OOM and hangs + ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM and hangs if (size > 1024) { GetByteContext gbc; @@ -260,6 +262,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ec_pixels += ctx->width * ctx->height; if (it > 20 || ec_pixels > 4 * ctx->max_pixels) ctx->error_concealment = 0; + if (ec_pixels > maxpixels) + goto maximums_reached; if (ret <= 0 || ret > avpkt.size) break; @@ -270,6 +274,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { } } } +maximums_reached: av_init_packet(&avpkt); avpkt.data = NULL;