aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-12-08 19:37:46 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-02 19:55:09 +0200
commit5e874507e141143cdd7fbc6c09054d5e295369d4 (patch)
treed5dcfd52f8d46ea53965e1db86e37e0f41c72705
parentb4e369cf36994a6127f2747582f2565116ef8609 (diff)
downloadffmpeg-5e874507e141143cdd7fbc6c09054d5e295369d4.tar.gz
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 c56a52a82c0a4039e606e82b948a8abfe417f35f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/vc1dec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 1c9af34368..ca39ceed1d 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1012,7 +1012,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
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;
if (v->field_mode) {
s->current_picture.f->linesize[0] <<= 1;
@@ -1084,8 +1084,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
continue;
}
ff_vc1_decode_blocks(v);
- if (i != n_slices)
+ if (i != n_slices) {
s->gb = slices[i].gb;
+ v->bits = FFMIN(buf_size * 8, s->gb.size_in_bits);
+ }
}
if (v->field_mode) {
v->second_field = 0;