aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-13 17:12:00 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-13 18:40:21 +0200
commitdffb85a98271826f6b38835b3c38399704bca3c0 (patch)
tree641098a0129a5dc0def19f1e5f1daad673eb348d
parent4a0ec85b85090c5ed7af232007d3e11308c926dc (diff)
downloadffmpeg-dffb85a98271826f6b38835b3c38399704bca3c0.tar.gz
avcodec/mpegvideo: check that linesize is not too small
Note linesize is rounded up to at least a multiple of 8 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mpegvideo.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1cef34ab0b..97f22d2dc0 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -434,6 +434,11 @@ static int frame_size_alloc(MpegEncContext *s, int linesize)
{
int alloc_size = FFALIGN(FFABS(linesize) + 64, 32);
+ if (linesize < 24) {
+ av_log(s->avctx, AV_LOG_ERROR, "Image too small, temporary buffers cannot function\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
// edge emu needs blocksize + filter length - 1
// (= 17x17 for halfpel / 21x21 for h264)
// VC1 computes luma and chroma simultaneously and needs 19X19 + 9x9