avcodec/vc1dec: Limit bits by the actual bitstream size
Fixes: Timeout (350 ->19sec)
Fixes: 19249/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-6566896438870016
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 c56a52a82c
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -1033,7 +1033,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
ff_mpeg_er_frame_start(s);
|
ff_mpeg_er_frame_start(s);
|
||||||
|
|
||||||
v->bits = buf_size * 8;
|
v->bits = FFMIN(buf_size * 8, s->gb.size_in_bits);
|
||||||
v->end_mb_x = s->mb_width;
|
v->end_mb_x = s->mb_width;
|
||||||
if (v->field_mode) {
|
if (v->field_mode) {
|
||||||
s->current_picture.f->linesize[0] <<= 1;
|
s->current_picture.f->linesize[0] <<= 1;
|
||||||
@@ -1107,8 +1107,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ff_vc1_decode_blocks(v);
|
ff_vc1_decode_blocks(v);
|
||||||
if (i != n_slices)
|
if (i != n_slices) {
|
||||||
s->gb = slices[i].gb;
|
s->gb = slices[i].gb;
|
||||||
|
v->bits = FFMIN(buf_size * 8, s->gb.size_in_bits);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (v->field_mode) {
|
if (v->field_mode) {
|
||||||
v->second_field = 0;
|
v->second_field = 0;
|
||||||
|
Reference in New Issue
Block a user