]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/zmbv: Check that the buffer is large enough for mvec
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 15 Nov 2017 16:11:12 +0000 (17:11 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 18 Nov 2017 10:57:57 +0000 (11:57 +0100)
Fixes: Timeout
Fixes: 4143/clusterfuzz-testcase-4736864637419520
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/zmbv.c

index b09dc41ebd2aea08b21d33ea1998678cf82eef60..f91d2e393179d4a025ba1fef28ed5c73955aff35 100644 (file)
@@ -539,6 +539,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
     } else {
         frame->key_frame = 0;
         frame->pict_type = AV_PICTURE_TYPE_P;
     } else {
         frame->key_frame = 0;
         frame->pict_type = AV_PICTURE_TYPE_P;
+        if (c->decomp_len < 2LL * ((c->width + c->bw - 1) / c->bw) * ((c->height + c->bh - 1) / c->bh))
+            return AVERROR_INVALIDDATA;
         if (c->decomp_len)
             c->decode_xor(c);
     }
         if (c->decomp_len)
             c->decode_xor(c);
     }