avcodec/ansi: Check dimensions

Fixes: 1.avi

Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 69449da436)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2016-09-26 20:25:59 +02:00
parent 6438fb1340
commit a672688086
1 changed files with 3 additions and 0 deletions

View File

@ -94,6 +94,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
int ret = ff_set_dimensions(avctx, 80 << 3, 25 << 4); int ret = ff_set_dimensions(avctx, 80 << 3, 25 << 4);
if (ret < 0) if (ret < 0)
return ret; return ret;
} else if (avctx->width % FONT_WIDTH || avctx->height % s->font_height) {
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height);
return AVERROR(EINVAL);
} }
return 0; return 0;
} }