From: Andreas Cadhalpun Date: Thu, 24 Nov 2016 22:57:46 +0000 (+0100) Subject: mss2: only use error correction for matching block counts X-Git-Tag: android-x86-7.1-r1~252^2~207 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1762a39e09a3edc27d1ef7bc50070f496b893aa4;p=android-x86%2Fexternal-ffmpeg.git 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 Signed-off-by: Luca Barbato --- diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 355bb32e1b..6fcadb16c9 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -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);