mss2: only use error correction for matching block counts

This fixes a heap-buffer-overflow in ff_er_frame_end when decoding mss2
with coded_width/coded_height larger than width/height.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Andreas Cadhalpun 2016-11-24 23:57:46 +01:00 committed by Luca Barbato
parent d0c84c41d3
commit 1762a39e09
1 changed files with 7 additions and 1 deletions

View File

@ -416,7 +416,13 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size,
ff_vc1_decode_blocks(v);
ff_er_frame_end(&s->er);
if (v->end_mb_x == s->mb_width && s->end_mb_y == s->mb_height) {
ff_er_frame_end(&s->er);
} else {
av_log(v->s.avctx, AV_LOG_WARNING,
"disabling error correction due to block count mismatch %dx%d != %dx%d\n",
v->end_mb_x, s->end_mb_y, s->mb_width, s->mb_height);
}
ff_mpv_frame_end(s);