4xm: Reject not a multiple of 16 dimension
authorLuca Barbato <lu_zero@gentoo.org>
Mon, 22 Jul 2013 10:44:19 +0000 (12:44 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Tue, 23 Jul 2013 21:03:37 +0000 (23:03 +0200)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/4xm.c

index a4e6965..1489c32 100644 (file)
@@ -807,6 +807,12 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     if (buf_size < 20)
         return AVERROR_INVALIDDATA;
 
+    if (avctx->width % 16 || avctx->height % 16) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Dimensions non-multiple of 16 are invalid.\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (buf_size < AV_RL32(buf + 4) + 8) {
         av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n",
                buf_size, AV_RL32(buf + 4));