[FFmpeg-cvslog] jvdec: check frame dimensions

Anton Khirnov git at videolan.org
Sat Dec 20 12:20:14 CET 2014


ffmpeg | branch: release/2.4 | Anton Khirnov <anton at khirnov.net> | Sun Dec 14 21:01:59 2014 +0100| [55788572ea7b89cdd77bab1cf4bf06d14ead34f5] | committer: Anton Khirnov

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 at 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 at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55788572ea7b89cdd77bab1cf4bf06d14ead34f5
---

 libavcodec/jvdec.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index bb347e0..2a7aa10 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);



More information about the ffmpeg-cvslog mailing list