[FFmpeg-cvslog] jvdec: check frame dimensions

Anton Khirnov git at videolan.org
Tue Jan 6 19:35:32 CET 2015


ffmpeg | branch: release/2.3 | Anton Khirnov <anton at khirnov.net> | Sun Dec 14 21:01:59 2014 +0100| [b5dbe93c8bc4b2180f9723a7a68b1db5591f3168] | committer: Michael Niedermayer

jvdec: check frame dimensions

The frame size must be set by the caller and each dimension must be a
multiple of 8.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
See: 105654e376a736d243aef4a1d121abebce912e6b
These should be redundant, but are backported for saftey anyway
(cherry picked from commit e012cb8dea7969c7b3927dbf846ef2742cd4a7ab)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 47e8edc..9c4a8d4 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