roqvideodec: check dimensions validity

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3ae6104511)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fee26d352a)

CC: libav-stable@libav.org

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:
Michael Niedermayer 2012-11-29 15:18:17 +01:00 committed by Reinhard Tartler
parent f7d18deb73
commit 488f87be87
1 changed files with 7 additions and 0 deletions

View File

@ -159,6 +159,13 @@ static av_cold int roq_decode_init(AVCodecContext *avctx)
RoqContext *s = avctx->priv_data;
s->avctx = avctx;
if (avctx->width % 16 || avctx->height % 16) {
av_log(avctx, AV_LOG_ERROR,
"Dimensions must be a multiple of 16\n");
return AVERROR_PATCHWELCOME;
}
s->width = avctx->width;
s->height = avctx->height;
s->last_frame = &s->frames[0];