Browse code

avcodec/dxa: check dimensions

Fixes out of array access
Fixes: asan_heap-oob_11222fb_21_020.dxa
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e70312dfc22c4e54d5716f28f28db8f99c74cc90)

Conflicts:

libavcodec/dxa.c

Michael Niedermayer authored on 2014/10/28 23:26:42
Showing 1 changed files
... ...
@@ -306,6 +306,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
306 306
 
307 307
     avctx->pix_fmt = AV_PIX_FMT_PAL8;
308 308
 
309
+    if (avctx->width%4 || avctx->height%4) {
310
+        avpriv_request_sample(avctx, "dimensions are not a multiple of 4");
311
+        return AVERROR_INVALIDDATA;
312
+    }
313
+
309 314
     c->prev = av_frame_alloc();
310 315
     if (!c->prev)
311 316
         return AVERROR(ENOMEM);