From 1851e1d05d06f6ef3436c667e4354da0f407b226 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Wed, 31 Jul 2013 12:45:33 +0300 Subject: [PATCH] rtpproto: Check the size before reading buf[1] MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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ö --- 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; -- 2.7.4