aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-12-14 21:01:59 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-06 18:28:34 +0100
commit8a01fb3729e58aab2fdc17ed6ddfa2c4efb3a54c (patch)
treeda61d018f408f9b7faa2293a5689fe627c24057f
parentb5dbe93c8bc4b2180f9723a7a68b1db5591f3168 (diff)
downloadffmpeg-8a01fb3729e58aab2fdc17ed6ddfa2c4efb3a54c.tar.gz
mmvideo: check frame dimensions
The frame size must be set by the caller and each dimension must be a multiple of 2. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> See: 8b0e96e1f21b761ca15dbb470cd619a1ebf86c3e These should be redundant, but are backported for saftey anyway (cherry picked from commit b0273232d8fffdc8a977ccdad460b8071a0e353c) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mmvideo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index baedccd7f1..9af35e5108 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -61,6 +61,13 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ if (!avctx->width || !avctx->height ||
+ (avctx->width & 1) || (avctx->height & 1)) {
+ 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);