[FFmpeg-devel] [PATCH 1/5] avcodec/midivid: Check vector index

Michael Niedermayer michael at niedermayer.cc
Sun Feb 9 21:14:20 EET 2020


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 <michael at niedermayer.cc>
---
 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];
-- 
2.17.1



More information about the ffmpeg-devel mailing list