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 commit88626e5af8
) Signed-off-by: Anton Khirnov <anton@khirnov.net> (cherry picked from commit55788572ea
) Signed-off-by: Anton Khirnov <anton@khirnov.net> (cherry picked from commit8f238dd9bd
) Signed-off-by: Anton Khirnov <anton@khirnov.net> Conflicts: libavcodec/jvdec.c (cherry picked from commit50cb695bf1
) Signed-off-by: Anton Khirnov <anton@khirnov.net> Conflicts: libavcodec/jvdec.c
This commit is contained in:
@@ -42,6 +42,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
JvContext *s = avctx->priv_data;
|
JvContext *s = avctx->priv_data;
|
||||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||||
dsputil_init(&s->dsp, avctx);
|
dsputil_init(&s->dsp, avctx);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user