[FFmpeg-cvslog] rtpproto: Check the size before reading buf[1]

Martin Storsjö git at videolan.org
Thu Aug 1 13:51:23 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed Jul 31 12:45:33 2013 +0300| [1851e1d05d06f6ef3436c667e4354da0f407b226] | committer: Martin Storsjö

rtpproto: Check the size before reading buf[1]

I doubt that anyone ever would try to send a 1 byte packet
via the RTP protocol, but check just in case - it shouldn't
crash at least.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/rtpproto.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 4e177b9..b21c121 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -368,6 +368,9 @@ static int rtp_write(URLContext *h, const uint8_t *buf, int size)
     int ret;
     URLContext *hd;
 
+    if (size < 2)
+        return AVERROR(EINVAL);
+
     if (RTP_PT_IS_RTCP(buf[1])) {
         /* RTCP payload type */
         hd = s->rtcp_hd;



More information about the ffmpeg-cvslog mailing list