diff mbox

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

Message ID 20171115162924.18146-1-michael@niedermayer.cc
State Accepted
Commit 2ab9568a2c3349039eec29fb960fe39de354b514
Headers show

Commit Message

Michael Niedermayer Nov. 15, 2017, 4:29 p.m. UTC
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 | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Nov. 18, 2017, 1:47 a.m. UTC | #1
On Wed, Nov 15, 2017 at 05:29:24PM +0100, Michael Niedermayer wrote:
> 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 | 2 ++
>  1 file changed, 2 insertions(+)

applied

[...]
diff mbox

Patch

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index b09dc41ebd..f91d2e3931 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);
     }