From 954aafaa961c32c655ad38fb622e8cbe249ebd5a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 14 Dec 2014 21:01:59 +0100 Subject: jvdec: check frame dimensions The frame size must be set by the caller and each dimension must be a multiple of 8. CC: libav-stable@libav.org Bug-ID: CVE-2014-8542 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind (cherry picked from commit 88626e5af8d006e67189bf10b96b982502a7e8ad) Signed-off-by: Anton Khirnov (cherry picked from commit 55788572ea7b89cdd77bab1cf4bf06d14ead34f5) Signed-off-by: Anton Khirnov (cherry picked from commit 8f238dd9bdd9eba569fcaa564a07fbdd89412a14) Signed-off-by: Anton Khirnov Conflicts: libavcodec/jvdec.c (cherry picked from commit 50cb695bf124b0bd4d9e2b3c1bfdd08b35b14438) Signed-off-by: Anton Khirnov Conflicts: libavcodec/jvdec.c --- libavcodec/jvdec.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libavcodec/jvdec.c') diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c index f2c97526c0..cc05688652 100644 --- a/libavcodec/jvdec.c +++ b/libavcodec/jvdec.c @@ -42,6 +42,14 @@ static av_cold int decode_init(AVCodecContext *avctx) JvContext *s = avctx->priv_data; avctx->pix_fmt = PIX_FMT_PAL8; dsputil_init(&s->dsp, avctx); + + if (!avctx->width || !avctx->height || + (avctx->width & 7) || (avctx->height & 7)) { + av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n", + avctx->width, avctx->height); + return AVERROR(EINVAL); + } + return 0; } -- cgit v1.2.1