From patchwork Sun Feb 9 19:14:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 17741 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 A83E844A90D for ; Sun, 9 Feb 2020 21:15:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 97732688390; Sun, 9 Feb 2020 21:15:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-1.mx.upcmail.net (vie01a-dmta-pe03-1.mx.upcmail.net [62.179.121.160]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7A8D568A0F8 for ; Sun, 9 Feb 2020 21:15:25 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1j0s3B-0009xG-1a for ffmpeg-devel@ffmpeg.org; Sun, 09 Feb 2020 20:15:25 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 0s2CjChWOwlys0s2CjG0Xx; Sun, 09 Feb 2020 20:14:24 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=E5OzWpVl c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=YxL7YUi4UxS_Z-monksA:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=bWyr8ysk75zN3GCy5bjg:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 9 Feb 2020 20:14:20 +0100 Message-Id: <20200209191424.19041-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfFBdn9+zzLHnKsuuwPzbVsKXi58SQ3dB5HoCFlNgOErGVSkrAR3dq3SamWbvVuZ3TOsz5AUDJB+T5sSKcYTbTbyL9EQMAR+w3ppDlgO75uUru9rjrmgl 9tVeyOmV6PUpD8w/ZgMpMJ+YyQk+Np0Ir+IK1wxCjBgqk85Hu0ecEfaH Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/midivid: Check vector index 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: out of array read Fixes: 20494/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVDV_fuzzer-5681452423577600 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/midivid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c index bb5105bd57..8d4c3b369e 100644 --- a/libavcodec/midivid.c +++ b/libavcodec/midivid.c @@ -126,6 +126,8 @@ static int decode_mvdv(MidiVidContext *s, AVCodecContext *avctx, AVFrame *frame) idx9bits--; idx = bytestream2_get_byte(gb) | (((idx9val >> (7 - idx9bits)) & 1) << 8); } + if (idx >= nb_vectors) + return AVERROR_INVALIDDATA; dsty[x +frame->linesize[0]] = vec[idx * 12 + 0]; dsty[x+1+frame->linesize[0]] = vec[idx * 12 + 3];