From: Michael Niedermayer Date: Mon, 5 Dec 2016 10:14:51 +0000 (+0100) Subject: avformat/rtmppkt: Check for packet size mismatches X-Git-Tag: archive/raspbian/6%11.12-1_deb8u9+rpi1^2~42 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=da0ad66b2dad733506254b1f04ae52db6f55886b;p=libav.git avformat/rtmppkt: Check for packet size mismatches Fixes out of array access Found-by: Paul Cher Reviewed-by: Paul Cher Signed-off-by: Michael Niedermayer Gbp-Pq: Name CVE-2016-10191.patch --- diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index 37fbb5f..49e67df 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -235,6 +235,14 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, if (hdr != RTMP_PS_TWELVEBYTES) timestamp += prev_pkt[channel_id].timestamp; + if (prev_pkt[channel_id].read && size != prev_pkt[channel_id].size) { + av_log(NULL, AV_LOG_ERROR, "RTMP packet size mismatch %d != %d\n", + size, + prev_pkt[channel_id].size); + ff_rtmp_packet_destroy(&prev_pkt[channel_id]); + prev_pkt[channel_id].read = 0; + } + if (!prev_pkt[channel_id].read) { if ((ret = ff_rtmp_packet_create(p, channel_id, type, timestamp, size)) < 0)