aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-12-14 21:01:59 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-22 03:17:56 +0100
commit50f4543c6b37c2f16f3d40712db82abbe07c7887 (patch)
treecc87b3c2a7b9324d9bcb114f15b63b74dd0c7ac1 /libavcodec
parent1344e91f33c87e4dba08e8dc316cb6532dec8ba7 (diff)
downloadffmpeg-50f4543c6b37c2f16f3d40712db82abbe07c7887.tar.gz
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@gmx.at> See: 105654e376a736d243aef4a1d121abebce912e6b These should be redundant, but are backported for saftey anyway
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/jvdec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 47e8edcae6..9c4a8d4ca3 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);