Browse Source

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>
tags/n3.1
Andreas Cadhalpun Luca Barbato 9 years ago
parent
commit
2e6ba1993e
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      libavformat/asfdec.c

+ 4
- 0
libavformat/asfdec.c View File

@@ -1291,6 +1291,10 @@ static int asf_read_payload(AVFormatContext *s, AVPacket *pkt)
} }
if (!asf_pkt) { if (!asf_pkt) {
if (asf->packet_offset + asf->packet_size <= asf->data_offset + asf->data_size) { 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); 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", av_log(s, AV_LOG_WARNING, "Skipping the stream with the invalid stream index %d.\n",
asf->stream_index); asf->stream_index);


Loading…
Cancel
Save