From patchwork Thu Jan 31 00:23:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 11922 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 ED7BA44C5B6 for ; Thu, 31 Jan 2019 02:24:51 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 095D168AB72; Thu, 31 Jan 2019 02:24:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-3.mx.upcmail.net (vie01a-dmta-pe07-3.mx.upcmail.net [84.116.36.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AFB0D68AB70 for ; Thu, 31 Jan 2019 02:24:33 +0200 (EET) 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.88) (envelope-from ) id 1gp0A2-0003bn-1m for ffmpeg-devel@ffmpeg.org; Thu, 31 Jan 2019 01:24:54 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id p093g92Bh2WSsp093gbFpx; Thu, 31 Jan 2019 01:23:54 +0100 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=E7kcWpVl 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=nZOtpAppAAAA:20 a=gxasCBzpGv3HCI0STJYA:9 a=pHzHmUro8NiASowvMSCR:22 a=nt3jZW36AmriUCFCBwmW:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 31 Jan 2019 01:23:51 +0100 Message-Id: <20190131002351.10475-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfNGCwObjzHvSc9iJNzCFLbFPPeDm+37c1OWKvocktRDKQFAq6xELYBfVxBRYc+JQoby1e8h/xSsuLSerYiZCIIMsCHNE/SylmykBz3ofrsDXCukiQP1d VSxqFXV6EEcmVStFJDGIiRLLvIl1rMlbAVJzl5vuhWDdzoMOzy9nkCga Subject: [FFmpeg-devel] [PATCH] avcodec/ac3: Explicitly return to discard large amounts of nonsense bytes 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" Changes 19sec to 10ms (12559) runtime, 17sec to 177ms (12570) Fixes: Timeout Fixes: 12559/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_fuzzer-5666516266123264 Fixes: 12561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-5682923041193984 Fixes: 12570/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-5194734308425728 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ac3dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index f844a463ee..eaa327a3ee 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1490,6 +1490,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, } if (i >= buf_size) return AVERROR_INVALIDDATA; + if (i > 10) + return i; buf += i; buf_size -= i;