asfdec: make sure packet_size is non-zero before seeking

This fixes infinite loops due to seeking back.

Signed-off-by: Alexandra Hájková <alexandra@khirnov.net>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Andreas Cadhalpun 2016-01-07 10:02:53 +01:00 committed by Luca Barbato
parent bf50607ab7
commit 2e6ba1993e
1 changed files with 4 additions and 0 deletions

View File

@ -1291,6 +1291,10 @@ static int asf_read_payload(AVFormatContext *s, AVPacket *pkt)
}
if (!asf_pkt) {
if (asf->packet_offset + asf->packet_size <= asf->data_offset + asf->data_size) {
if (!asf->packet_size) {
av_log(s, AV_LOG_ERROR, "Invalid packet size 0.\n");
return AVERROR_INVALIDDATA;
}
avio_seek(pb, asf->packet_offset + asf->packet_size, SEEK_SET);
av_log(s, AV_LOG_WARNING, "Skipping the stream with the invalid stream index %d.\n",
asf->stream_index);