[FFmpeg-cvslog] avcodec/mpegvideo: check that linesize is not too small

Michael Niedermayer git at videolan.org
Fri Jun 13 19:01:01 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jun 13 17:12:00 2014 +0200| [dffb85a98271826f6b38835b3c38399704bca3c0] | committer: Michael Niedermayer

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 at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dffb85a98271826f6b38835b3c38399704bca3c0
---

 libavcodec/mpegvideo.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1cef34a..97f22d2 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



More information about the ffmpeg-cvslog mailing list