[FFmpeg-devel] [PATCH][RFC]lavf/rtpenc_jpeg: Do not allow invalid resolutions

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Dec 9 15:34:26 CET 2015


Hi!

This should imo not get applied if there are applications that allow larger 
resolutions.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index 60629cf..c50f25f 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -41,6 +41,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
     s->buf_ptr   = s->buf;
     s->timestamp = s->cur_timestamp;
 
+    if (s1->streams[0]->codec->width > 2040 || s1->streams[0]->codec->height > 2040) {
+        av_log(s1, AV_LOG_ERROR,
+               "RFC 2435 does not allow resolutions > 2040x2040\n");
+        return;
+    }
     /* convert video pixel dimensions from pixels to blocks */
     w = FF_CEIL_RSHIFT(s1->streams[0]->codec->width, 3);
     h = FF_CEIL_RSHIFT(s1->streams[0]->codec->height, 3);


More information about the ffmpeg-devel mailing list