[FFmpeg-devel,2/2] avcodec/wmv2dec: Skip I frame if its smaller than 1/8 of the minimal size

Submitted by Michael Niedermayer on Nov. 28, 2018, 12:46 a.m.

Details

Message ID 20181128004650.30626-2-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Nov. 28, 2018, 12:46 a.m.
Fixes: Timeout
Fixes: 11168/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5733782032744448

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

Patch hide | download patch | download mbox

diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 4f97d9227c..1858dc15c6 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -181,6 +181,8 @@  int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
             }
 
             s->dc_table_index = get_bits1(&s->gb);
+            if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16))
+                return AVERROR_INVALIDDATA;
         }
         s->inter_intra_pred = 0;
         s->no_rounding      = 1;