]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/vb: Check for end of bytestream before reading blocktype
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 20 Aug 2018 20:19:23 +0000 (22:19 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 25 Aug 2018 19:50:17 +0000 (21:50 +0200)
Fixes: Timeout
Fixes: 9601/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VB_fuzzer-4550228702134272
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vb.c

index 021657f7d8757ed576eaa0976df0ae3f19a4f44f..c6dd6fb4561e11a2004fb4707806b11355881e77 100644 (file)
@@ -107,6 +107,10 @@ static int vb_decode_framedata(VBDecContext *c, int offset)
     blk2   = 0;
     for (blk = 0; blk < blocks; blk++) {
         if (!(blk & 3)) {
+            if (bytestream2_get_bytes_left(&g) < 1) {
+                av_log(c->avctx, AV_LOG_ERROR, "Insufficient data\n");
+                return AVERROR_INVALIDDATA;
+            }
             blocktypes = bytestream2_get_byte(&g);
         }
         switch (blocktypes & 0xC0) {