Commit 4d870010 authored by Michael Niedermayer's avatar Michael Niedermayer

vp8: fix crash due to skiped update_dimensions().

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 70d54392
...@@ -108,7 +108,7 @@ static void vp8_decode_flush(AVCodecContext *avctx) ...@@ -108,7 +108,7 @@ static void vp8_decode_flush(AVCodecContext *avctx)
static int update_dimensions(VP8Context *s, int width, int height) static int update_dimensions(VP8Context *s, int width, int height)
{ {
if (width != s->avctx->width || if (width != s->avctx->width || ((width+15)/16 != s->mb_width || (height+15)/16 != s->mb_height) && s->macroblocks_base ||
height != s->avctx->height) { height != s->avctx->height) {
if (av_image_check_size(width, height, 0, s->avctx)) if (av_image_check_size(width, height, 0, s->avctx))
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
...@@ -333,7 +333,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) ...@@ -333,7 +333,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
} }
if (!s->macroblocks_base || /* first frame */ if (!s->macroblocks_base || /* first frame */
width != s->avctx->width || height != s->avctx->height) { width != s->avctx->width || height != s->avctx->height || (width+15)/16 != s->mb_width || (height+15)/16 != s->mb_height) {
if ((ret = update_dimensions(s, width, height)) < 0) if ((ret = update_dimensions(s, width, height)) < 0)
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment