mirror of https://git.ffmpeg.org/ffmpeg.git
asf: prevent packet_size_left from going negative if hdrlen > pktlen.
This prevents failed assertions further down in the packet processing where we require non-negative values for packet_size_left. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
This commit is contained in:
parent
74699ac8c8
commit
41afac7f7a
|
@ -789,6 +789,13 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
|
||||||
asf->packet_segments = 1;
|
asf->packet_segments = 1;
|
||||||
asf->packet_segsizetype = 0x80;
|
asf->packet_segsizetype = 0x80;
|
||||||
}
|
}
|
||||||
|
if (rsize > packet_length - padsize) {
|
||||||
|
asf->packet_size_left = 0;
|
||||||
|
av_log(s, AV_LOG_ERROR,
|
||||||
|
"invalid packet header length %d for pktlen %d-%d at %"PRId64"\n",
|
||||||
|
rsize, packet_length, padsize, avio_tell(pb));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
asf->packet_size_left = packet_length - padsize - rsize;
|
asf->packet_size_left = packet_length - padsize - rsize;
|
||||||
if (packet_length < asf->hdr.min_pktsize)
|
if (packet_length < asf->hdr.min_pktsize)
|
||||||
padsize += asf->hdr.min_pktsize - packet_length;
|
padsize += asf->hdr.min_pktsize - packet_length;
|
||||||
|
|
Loading…
Reference in New Issue