summaryrefslogtreecommitdiff
path: root/libavcodec/jvdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-12-14 21:01:59 +0100
committerAnton Khirnov <anton@khirnov.net>2014-12-19 08:01:46 +0100
commit88626e5af8d006e67189bf10b96b982502a7e8ad (patch)
tree95acf284e1a737cbbaf0883a78df1dc69ef6c8f1 /libavcodec/jvdec.c
parent809c3023b699c54c90511913d3b6140dd2436550 (diff)
downloadffmpeg-88626e5af8d006e67189bf10b96b982502a7e8ad.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
Diffstat (limited to 'libavcodec/jvdec.c')
-rw-r--r--libavcodec/jvdec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index bb347e045a..2a7aa10254 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -43,6 +43,13 @@ 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);
+ }
+
s->frame = av_frame_alloc();
if (!s->frame)
return AVERROR(ENOMEM);