From patchwork Sat Dec 15 01:44:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 11420 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 3BAE544D37A for ; Sat, 15 Dec 2018 03:46:04 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 627EE68AB70; Sat, 15 Dec 2018 03:46:04 +0200 (EET) 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 4232668AB70 for ; Sat, 15 Dec 2018 03:45:58 +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 1gXz1i-0001CL-0R for ffmpeg-devel@ffmpeg.org; Sat, 15 Dec 2018 02:45:58 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id Xz0kgocdo2WSsXz0kgYvRk; Sat, 15 Dec 2018 02:44:58 +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=DrhfVaonbrB0ajkbkxcA:9 a=pHzHmUro8NiASowvMSCR:22 a=nt3jZW36AmriUCFCBwmW:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 15 Dec 2018 02:44:44 +0100 Message-Id: <20181215014444.8313-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181215014444.8313-1-michael@niedermayer.cc> References: <20181215014444.8313-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfMrwtyI/yk8OkUuBECo0fVfvE3S08dGl+2bZpnOXfKKsH6+dYFwOIfX3m+7qfXllL34XxnVvGZAG0gXCxtD/Uu9oKMV+m9kp5JjAXas9CmskfMfpSuww 9/1Q4HsQTFilAdTH/7fTUG4idlLE9gnop06Dqz5iFZJLBcUg5G4mlNAd Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/rasc: Check that the number of moves is less than or equal the number of 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" Fixes: OOM Fixes: 10307/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5393974559244288 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/rasc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c index 67351dfd19..1b607ac31e 100644 --- a/libavcodec/rasc.c +++ b/libavcodec/rasc.c @@ -215,7 +215,7 @@ static int decode_move(AVCodecContext *avctx, bytestream2_skip(gb, 8); compression = bytestream2_get_le32(gb); - if (nb_moves > INT32_MAX / 16) + if (nb_moves > INT32_MAX / 16 || nb_moves > avctx->width * avctx->height) return AVERROR_INVALIDDATA; uncompressed_size = 16 * nb_moves;