mjpegenc: add a limit for maximum supported resolution
authorPiotr Bandurski <ami_stuff@o2.pl>
Thu, 31 May 2012 11:49:00 +0000 (13:49 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 31 May 2012 14:57:47 +0000 (16:57 +0200)
jpeg does not allow more than 65000 pixels for width and height

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mjpegenc.c

index 9326d4d..53a45b4 100644 (file)
@@ -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;