avcodec/interplayvideo: Fix timeout from lack of bitstream end check
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 1 Mar 2017 16:56:23 +0000 (17:56 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 3 Mar 2017 00:03:29 +0000 (01:03 +0100)
Fixes: 697/clusterfuzz-testcase-6111250582863872

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

index 8d2f3ab..df3314d 100644 (file)
@@ -928,6 +928,8 @@ static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame)
     init_get_bits(&gb, s->decoding_map, s->decoding_map_size * 8);
     for (y = 0; y < s->avctx->height; y += 8) {
         for (x = 0; x < s->avctx->width; x += 8) {
+            if (get_bits_left(&gb) < 4)
+                return;
             opcode = get_bits(&gb, 4);
 
             ff_tlog(s->avctx,