diff mbox

[FFmpeg-devel,2/2] avcodec/indeo2: Check input size against resolution in ir2_decode_plane()

Message ID 20190317235037.26568-2-michael@niedermayer.cc
State Accepted
Commit 4ef27d40729c34f62b688c027b5c177c39e56656
Headers show

Commit Message

Michael Niedermayer March 17, 2019, 11:50 p.m. UTC
Fixes: Timeout (56 sec -> 14 sec)
Fixes: 13708/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO2_fuzzer-5656342004498432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/indeo2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index 4971b84308..09cb560d8e 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -56,7 +56,7 @@  static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
     int j;
     int out = 0;
 
-    if (width & 1)
+    if ((width & 1) || width * height / (2*(IR2_CODES - 0x7F)) > get_bits_left(&ctx->gb))
         return AVERROR_INVALIDDATA;
 
     /* first line contain absolute values, other lines contain deltas */