avcodec/vp8: Check for bitstream end before vp7_fade_frame()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 17 Feb 2018 03:20:52 +0000 (04:20 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 17 Feb 2018 19:31:39 +0000 (20:31 +0100)
Fixes: Timeout
Fixes: 5653/clusterfuzz-testcase-5497680018014208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vp8.c

index 7f71a75..62b9f8b 100644 (file)
@@ -656,6 +656,8 @@ static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
             s->fade_present = vp8_rac_get(c);
     }
 
+    if (c->end <= c->buffer && c->bits >= 0)
+        return AVERROR_INVALIDDATA;
     /* E. Fading information for previous frame */
     if (s->fade_present && vp8_rac_get(c)) {
         if ((ret = vp7_fade_frame(s ,c)) < 0)