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

Michael Niedermayer git at videolan.org
Wed Jun 17 22:09:38 CEST 2015


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Tue May 12 17:55:40 2015 +0200| [b8060bc217e446e2e617798e11c3eab048d4bb41] | 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=b8060bc217e446e2e617798e11c3eab048d4bb41
---

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

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index d6691f2..59baf3b 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -80,6 +80,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