]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/eatqi: Check for minimum frame size
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 28 Jul 2019 20:29:57 +0000 (22:29 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 29 Jul 2019 20:58:43 +0000 (22:58 +0200)
The minimum header is 8 bytes, the smallest bitstream that is passed to
the MB decode code is 4 bytes

Fixes: Timeout (35sec -> 18sec)
Fixes: 15800/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATQI_fuzzer-5684154517159936
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/eatqi.c

index 0002d454570bc1201b435454bbd26aeda3318ca1..96536b1a082f0082aa406f756adc8604a5372b56 100644 (file)
@@ -131,6 +131,9 @@ static int tqi_decode_frame(AVCodecContext *avctx,
     AVFrame *frame = data;
     int ret, w, h;
 
+    if (buf_size < 12)
+        return AVERROR_INVALIDDATA;
+
     t->avctx = avctx;
 
     w = AV_RL16(&buf[0]);