[FFmpeg-cvslog] avcodec/zmbv: Check that the buffer is large enough for mvec

Michael Niedermayer git at videolan.org
Sat Dec 2 01:50:00 EET 2017


ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Wed Nov 15 17:11:12 2017 +0100| [b9b4d34ecfdd49b9962491c32422b906e2f455ac] | committer: Michael Niedermayer

avcodec/zmbv: Check that the buffer is large enough for mvec

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 at niedermayer.cc>
(cherry picked from commit 2ab9568a2c3349039eec29fb960fe39de354b514)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9b4d34ecfdd49b9962491c32422b906e2f455ac
---

 libavcodec/zmbv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 25a1cd215d..39a08db0eb 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -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;
+        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);
     }



More information about the ffmpeg-cvslog mailing list