summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorStefan Gehrer <stefan.gehrer@gmx.de>2010-12-03 07:49:07 +0000
committerStefan Gehrer <stefan.gehrer@gmx.de>2010-12-03 07:49:07 +0000
commit77b7c334be9712af37ad7062179e8043b83ffc76 (patch)
treebf6260d722333773facf83d4c0edf76ab0ae6f05 /libavformat
parent037be76e1588fc8135dd307ba0be4c792b3e93e6 (diff)
skip top-level objects to search for the simple index in ASF files
Originally committed as revision 25863 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfdec.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index b4be9d466f..59f670bf45 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1138,7 +1138,20 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
get_guid(s->pb, &g);
- if (!guidcmp(&g, &index_guid)) {
+
+ /* the data object can be followed by other top-level objects,
+ skip them until the simple index object is reached */
+ while (guidcmp(&g, &index_guid)) {
+ int64_t gsize= get_le64(s->pb);
+ if (gsize < 24 || url_feof(s->pb)) {
+ url_fseek(s->pb, current_pos, SEEK_SET);
+ return;
+ }
+ url_fseek(s->pb, gsize-24, SEEK_CUR);
+ get_guid(s->pb, &g);
+ }
+
+ {
int64_t itime, last_pos=-1;
int pct, ict;
int64_t av_unused gsize= get_le64(s->pb);