[FFmpeg-devel] [PATCH 2/4] avcodec/mv30: Check available space in decode_intra() more completly

Michael Niedermayer michael at niedermayer.cc
Thu Feb 11 23:17:13 EET 2021


Fixes: Timeout (>10sec -> instantaneous)
Fixes: 30147/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5549246684200960

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/mv30.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/mv30.c b/libavcodec/mv30.c
index 7ae264e0f0..c92048a179 100644
--- a/libavcodec/mv30.c
+++ b/libavcodec/mv30.c
@@ -411,6 +411,8 @@ static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame
     mgb = *gb;
     if (get_bits_left(gb) < s->mode_size * 8)
         return AVERROR_INVALIDDATA;
+    if (get_bits_left(&mgb) < (avctx->height + 15)/16 * ((avctx->width + 15)/16) * 12)
+        return AVERROR_INVALIDDATA;
 
     skip_bits_long(gb, s->mode_size * 8);
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list