Commit 7d57ca4d authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/rtmppkt: Check for packet size mismatches

Fixes out of array access
Found-by: 's avatarPaul Cher <paulcher@icloud.com>
Reviewed-by: 's avatarPaul Cher <paulcher@icloud.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent d903b4e3
...@@ -235,6 +235,14 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, ...@@ -235,6 +235,14 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p,
if (hdr != RTMP_PS_TWELVEBYTES) if (hdr != RTMP_PS_TWELVEBYTES)
timestamp += prev_pkt[channel_id].timestamp; 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 (!prev_pkt[channel_id].read) {
if ((ret = ff_rtmp_packet_create(p, channel_id, type, timestamp, if ((ret = ff_rtmp_packet_create(p, channel_id, type, timestamp,
size)) < 0) size)) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment