From: Martin Storsjö Date: Wed, 31 Jul 2013 09:45:33 +0000 (+0300) Subject: rtpproto: Check the size before reading buf[1] X-Git-Tag: v10_alpha1~1056 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1851e1d05d06f6ef3436c667e4354da0f407b226;p=platform%2Fupstream%2Flibav.git 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ö --- 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;