]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/eatgv: Check remaining size after the keyframe header
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 28 Jul 2019 19:09:14 +0000 (21:09 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 29 Jul 2019 20:58:43 +0000 (22:58 +0200)
The minimal size which unpack() will not fail on is 5 bytes
Fixes: Timeout (14sec -> 77ms) (testcase 15508)
Fixes: 15508/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGV_fuzzer-5700053513011200
Fixes: 15996/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGV_fuzzer-5751353223151616
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/eatgv.c

index 93e291f0534eab04dcba73da36f18f6eeaf062d5..f82f7b9cca8df742be12a8f4c03212db2dc30010 100644 (file)
@@ -300,6 +300,9 @@ static int tgv_decode_frame(AVCodecContext *avctx,
             s->palette[i] = 0xFFU << 24 | AV_RB24(buf);
             buf += 3;
         }
+        if (buf_end - buf < 5) {
+            return AVERROR_INVALIDDATA;
+        }
     }
 
     if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)