aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-04-19 15:50:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commit9c858980560dbab441b12c91287798d40a8e3bae (patch)
treecb1bef49111a894efdffa6667d65fcf327c52c9e
parent75b816f2c4f6482fb02425535ba97e34e94f4ccb (diff)
downloadffmpeg-9c858980560dbab441b12c91287798d40a8e3bae.tar.gz
avcodec/vc1: Check remaining bits in ff_vc1_parse_frame_header()
Fixes: Timeout Fixes: 33156/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3_fuzzer-6259655027326976 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 38c47615880357314ba30727a85bf7b00989706a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/vc1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index f88c83d7e4..86f72f32f4 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -676,6 +676,8 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
if (v->s.pict_type == AV_PICTURE_TYPE_P)
v->rnd ^= 1;
+ if (get_bits_left(gb) < 5)
+ return AVERROR_INVALIDDATA;
/* Quantizer stuff */
pqindex = get_bits(gb, 5);
if (!pqindex)
@@ -768,6 +770,9 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
"Imode: %i, Invert: %i\n", status>>1, status&1);
+ if (get_bits_left(gb) < 4)
+ return AVERROR_INVALIDDATA;
+
/* Hopefully this is correct for P-frames */
v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];