summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-28 15:26:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-12 00:47:05 +0100
commitf3cdeeb070d4793d98b16a7ad66049e537ab7ba7 (patch)
tree4a46d661f6cd88d9a8c5261e5c4dae14ea504fe4
parent79891f5b87baa9c17366a84950cb81b8f4f6e5f1 (diff)
downloadffmpeg-f3cdeeb070d4793d98b16a7ad66049e537ab7ba7.tar.gz
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 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/dxa.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c
index 807ecd85ee..7f4321ce91 100644
--- a/libavcodec/dxa.c
+++ b/libavcodec/dxa.c
@@ -295,6 +295,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8;
+ if (avctx->width%4 || avctx->height%4) {
+ av_log(avctx, AV_LOG_ERROR, "dimensions are not a multiple of 4");
+ return AVERROR_INVALIDDATA;
+ }
+
avcodec_get_frame_defaults(&c->pic);
avcodec_get_frame_defaults(&c->prev);