From patchwork Sat Dec 1 21:16:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 11248 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 794D544D5CD for ; Sat, 1 Dec 2018 23:18:15 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1FFFF68A11E; Sat, 1 Dec 2018 23:18:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-1.mx.upcmail.net (vie01a-dmta-pe08-1.mx.upcmail.net [84.116.36.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 908D06805C5 for ; Sat, 1 Dec 2018 23:18:09 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1gTCeW-0008Ej-0T for ffmpeg-devel@ffmpeg.org; Sat, 01 Dec 2018 22:18:16 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id TCdYgbArYkosQTCdYgnQXT; Sat, 01 Dec 2018 22:17:16 +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=NNQEBHyg 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=oBxq8xoIsveOMgzWbXwA:9 a=pHzHmUro8NiASowvMSCR:22 a=nt3jZW36AmriUCFCBwmW:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 1 Dec 2018 22:16:20 +0100 Message-Id: <20181201211620.21921-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181201211620.21921-1-michael@niedermayer.cc> References: <20181201211620.21921-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfEmyOvk2xvF3JOEnFuKFLugHrsv74eu/GIKIa4csUvwSlz0z0T1WobSaLW23txXuvzFvZuA7TmWKINfBney+x/D3y3LFsE/oU3UmH2rO4ysgLt5E9Hq6 5aazPYnik0bRSYTLmAGiPB28UQcLcSf0nLlUnsmU2rPv3UnaHhjiUk1A Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/dxv: Check that there is enough data to decompress 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" Fixes: Timeout Fixes: 10979/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-6178582203203584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dxv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index 08aca73b1f..bf53d7d706 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -1192,6 +1192,12 @@ static int dxv_decode(AVCodecContext *avctx, void *data, ret = decompress_tex(avctx); if (ret < 0) return ret; + { + int w_block = avctx->coded_width / ctx->texture_block_w; + int h_block = avctx->coded_height / ctx->texture_block_h; + if (w_block * h_block * ctx->tex_step > ctx->tex_size * 8LL) + return AVERROR_INVALIDDATA; + } tframe.f = data; ret = ff_thread_get_buffer(avctx, &tframe, 0);