[FFmpeg-devel,1/3] avcodec/wmv2dec: Check that the P frame secondary header fit in the input

Submitted by Michael Niedermayer on April 12, 2019, 11:36 p.m.

Details

Message ID 20190412233647.7668-1-michael@niedermayer.cc
State Accepted
Commit bcf9d2a17242b78dc4cd56731893c9a5781ecad2
Headers show

Commit Message

Michael Niedermayer April 12, 2019, 11:36 p.m.
Fixes: Timeout (64sec ->2 sec)
Fixes: 14131/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5719879556005888

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 | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer April 19, 2019, 6:13 p.m.
On Sat, Apr 13, 2019 at 01:36:45AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (64sec ->2 sec)
> Fixes: 14131/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV2_fuzzer-5719879556005888
> 
> 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 | 3 +++
>  1 file changed, 3 insertions(+)

will apply patchset

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 92daa1639e..124dfdb7e0 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -230,6 +230,9 @@  int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
             s->rl_chroma_table_index = s->rl_table_index;
         }
 
+        if (get_bits_left(&s->gb) < 2)
+            return AVERROR_INVALIDDATA;
+
         s->dc_table_index   = get_bits1(&s->gb);
         s->mv_table_index   = get_bits1(&s->gb);