roqvideodec: check dimensions validity
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 29 Nov 2012 14:18:17 +0000 (15:18 +0100)
committerReinhard Tartler <siretart@tauware.de>
Sun, 17 Feb 2013 10:31:20 +0000 (11:31 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3ae610451170cd5a28b33950006ff0bd23036845)

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

CC: libav-stable@libav.org
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/roqvideodec.c

index 2543cec..3ee62c0 100644 (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];