[FFmpeg-cvslog] mjpegenc: add a limit for maximum supported resolution

Piotr Bandurski git at videolan.org
Thu May 31 17:24:56 CEST 2012


ffmpeg | branch: master | Piotr Bandurski <ami_stuff at o2.pl> | Thu May 31 13:49:00 2012 +0200| [d2581dcca6abe74e3fbf44df815194a6aea71bd6] | committer: Michael Niedermayer

mjpegenc: add a limit for maximum supported resolution

jpeg does not allow more than 65000 pixels for width and height

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 9326d4d..53a45b4 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -48,6 +48,11 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
 {
     MJpegContext *m;
 
+    if (s->width > 65500 || s->height > 65500) {
+        av_log(s, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n");
+        return -1;
+    }
+
     m = av_malloc(sizeof(MJpegContext));
     if (!m)
         return -1;



More information about the ffmpeg-cvslog mailing list