mirror of https://git.ffmpeg.org/ffmpeg.git
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 38c4761588
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
f143bb05c6
commit
9e98ee41e7
|
@ -671,6 +671,8 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
|
||||||
if (v->s.pict_type == AV_PICTURE_TYPE_P)
|
if (v->s.pict_type == AV_PICTURE_TYPE_P)
|
||||||
v->rnd ^= 1;
|
v->rnd ^= 1;
|
||||||
|
|
||||||
|
if (get_bits_left(gb) < 5)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
/* Quantizer stuff */
|
/* Quantizer stuff */
|
||||||
pqindex = get_bits(gb, 5);
|
pqindex = get_bits(gb, 5);
|
||||||
if (!pqindex)
|
if (!pqindex)
|
||||||
|
@ -763,6 +765,9 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
|
||||||
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
|
av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
|
||||||
"Imode: %i, Invert: %i\n", status>>1, status&1);
|
"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 */
|
/* Hopefully this is correct for P-frames */
|
||||||
v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
|
v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
|
||||||
v->cbptab = get_bits(gb, 2);
|
v->cbptab = get_bits(gb, 2);
|
||||||
|
|
Loading…
Reference in New Issue