diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-20 00:40:09 +0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-09-22 22:02:52 +0400 |
commit | bb7bf175951475235ee7d0504198c4a30cf5d5dd (patch) | |
tree | befb171a7be5da5c4db1b95035e20fb2c399f8ff /libavcodec/vc1dec.c | |
parent | 5e25fdbfe01635cfc650ac4adc27d434b2df0d64 (diff) |
vc1dec: Don't decode slices when the latest slice header failed to decode
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/vc1dec.c')
-rw-r--r-- | libavcodec/vc1dec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 4fcc818210..602b155ecb 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -5972,6 +5972,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, if (avctx->hwaccel->end_frame(avctx) < 0) goto err; } else { + int header_ret = 0; + ff_mpeg_er_frame_start(s); v->bits = buf_size * 8; @@ -6009,18 +6011,20 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, if (i) { v->pic_header_flag = 0; if (v->field_mode && i == n_slices1 + 2) { - if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { + if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Field header damaged\n"); continue; } } else if (get_bits1(&s->gb)) { v->pic_header_flag = 1; - if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { + if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice header damaged\n"); continue; } } } + if (header_ret < 0) + continue; s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height); if (!v->field_mode || v->second_field) s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); |