Imported Debian version 2.5.2~trusty
[deb_ffmpeg.git] / ffmpeg / libavcodec / jvdec.c
index 47e8edcae60bd83f73476d0d75f46e51327e13a7..9c4a8d4ca3c48df051ddaca531e6e0c1436f8822 100644 (file)
@@ -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);