aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/asfdec.c
diff options
context:
space:
mode:
authorAlexandra Hájková <alexandra.khirnova@gmail.com>2015-11-19 14:25:41 +0100
committerLuca Barbato <lu_zero@gentoo.org>2015-11-23 11:42:55 +0100
commit8375dc1dd101d51baa430f34c0bcadfa37873896 (patch)
tree54b8ae5bbdfd936377e5482c323abb39a07e7246 /libavformat/asfdec.c
parentc12c085be7e86880924249e5cb3f898e45dee134 (diff)
downloadffmpeg-8375dc1dd101d51baa430f34c0bcadfa37873896.tar.gz
asfdec: handle the case when the stream index has an invalid value better
The demuxer returned INVALIDDATA and failed to demux the remaining data when an invalid stream index was read, now it just skips the asf packet for the stream with an invalid stream index and continues demuxing. Reported-By: Hendrik Leppkes Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r--libavformat/asfdec.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index e1b0b8c67b..ca7712fcac 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1276,8 +1276,16 @@ static int asf_read_payload(AVFormatContext *s, AVPacket *pkt)
break;
}
}
- if (!asf_pkt)
- return AVERROR_INVALIDDATA;
+ if (!asf_pkt) {
+ if (asf->packet_offset + asf->packet_size <= asf->data_offset + asf->data_size) {
+ 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);
+ return AVERROR(EAGAIN);
+ } else
+ return AVERROR_INVALIDDATA;
+ }
+
if (stream_num >> 7)
asf_pkt->flags |= AV_PKT_FLAG_KEY;
READ_LEN(asf->prop_flags & ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE,
@@ -1418,8 +1426,14 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
else
asf->state = READ_MULTI;
}
- if ((ret = asf_read_payload(s, pkt)) < 0)
+ ret = asf_read_payload(s, pkt);
+ if (ret == AVERROR(EAGAIN)) {
+ asf->state = PARSE_PACKET_HEADER;
+ continue;
+ }
+ else if (ret < 0)
return ret;
+
switch (asf->state) {
case READ_SINGLE:
if (!asf->sub_left)