[FFmpeg-cvslog] avformat/rtpenc_jpeg: Check remaining buffer size for SOS

Michael Niedermayer git at videolan.org
Sat May 16 00:16:16 CEST 2015


ffmpeg | branch: release/2.6 | Michael Niedermayer <michaelni at gmx.at> | Tue May 12 17:55:40 2015 +0200| [1933fa5daadf064b22d2c5b2912f35af85e47d9b] | committer: Michael Niedermayer

avformat/rtpenc_jpeg: Check remaining buffer size for SOS

Fixes CID1238818

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 81198a68370e88f7d02f16de58db36713c2a50b6)

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

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

 libavformat/rtpenc_jpeg.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index c353329..2e13e17 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -84,6 +84,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
         } else if (buf[i + 1] == SOS) {
             /* SOS is last marker in the header */
             i += AV_RB16(&buf[i + 2]) + 2;
+            if (i > size) {
+                av_log(s1, AV_LOG_ERROR,
+                       "Insufficient data. Aborted!\n");
+                return;
+            }
             break;
         }
     }



More information about the ffmpeg-cvslog mailing list