aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-12-14 21:01:59 +0100
committerAnton Khirnov <anton@khirnov.net>2014-12-20 11:10:32 +0100
commit50cb695bf124b0bd4d9e2b3c1bfdd08b35b14438 (patch)
tree2c71feeaa35af9566f13871168b004cb0e1815bc /libavcodec
parent93f919d0b4c4341ccee366c98ac9af813f8fe622 (diff)
downloadffmpeg-50cb695bf124b0bd4d9e2b3c1bfdd08b35b14438.tar.gz
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 <anton@khirnov.net> (cherry picked from commit 55788572ea7b89cdd77bab1cf4bf06d14ead34f5) Signed-off-by: Anton Khirnov <anton@khirnov.net> (cherry picked from commit 8f238dd9bdd9eba569fcaa564a07fbdd89412a14) Signed-off-by: Anton Khirnov <anton@khirnov.net> Conflicts: libavcodec/jvdec.c
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/jvdec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 8c919d290e..dad2c49f38 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -40,6 +40,14 @@ typedef struct JvContext {
static av_cold int decode_init(AVCodecContext *avctx)
{
JvContext *s = avctx->priv_data;
+
+ 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);
+ }
+
avctx->pix_fmt = AV_PIX_FMT_PAL8;
ff_dsputil_init(&s->dsp, avctx);
return 0;