eamad: Check against minimum supported dimensions

Fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-05-03 23:16:54 +02:00
parent b937d3694e
commit e756635964

View File

@ -257,6 +257,11 @@ static int decode_frame(AVCodecContext *avctx,
calc_quant_matrix(s, buf[13]);
buf += 16;
if (width < 16 || height < 16) {
av_log(avctx, AV_LOG_ERROR, "Dimensions too small\n");
return AVERROR_INVALIDDATA;
}
if (avctx->width != width || avctx->height != height) {
if((width * height)/2048*7 > buf_end-buf)
return AVERROR_INVALIDDATA;