avcodec/clearvideo: Check remaining data in P frames
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 8 Mar 2019 00:42:06 +0000 (01:42 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 17 Mar 2019 10:35:00 +0000 (11:35 +0100)
Fixes: Timeout (19sec -> 419msec)
Fixes: 13411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5733153811988480

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

index ad3012f..82df8f3 100644 (file)
@@ -555,6 +555,9 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
     } else {
         int plane;
 
+        if (c->pmb_width * c->pmb_height > 8LL*(buf_size - bytestream2_tell(&gb)))
+            return AVERROR_INVALIDDATA;
+
         if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
             return ret;