]> git.sesse.net Git - ffmpeg/commitdiff
mov: Drop dref when unable to parse
authorVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 9 Nov 2015 14:14:43 +0000 (15:14 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Thu, 12 Nov 2015 03:39:14 +0000 (04:39 +0100)
Some entries might be either empty or contain types we do not parse
(eg. 'url '). In both cases, if an 'alis' is not the first entry,
external references are not loaded, so make sure that the array starts
with an 'alis' dref.

libavformat/mov.c

index 2982bf2811c441756c9123b5cd0b6e59ab9567d1..c7495772febeb7f501b7435817cee149de851824 100644 (file)
@@ -482,7 +482,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         return AVERROR(ENOMEM);
     sc->drefs_count = entries;
 
-    for (i = 0; i < sc->drefs_count; i++) {
+    for (i = 0; i < entries; i++) {
         MOVDref *dref = &sc->drefs[i];
         uint32_t size = avio_rb32(pb);
         int64_t next = avio_tell(pb) + size - 4;
@@ -577,6 +577,11 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                 } else
                     avio_skip(pb, len);
             }
+        } else {
+            av_log(c->fc, AV_LOG_DEBUG, "Unknown dref type 0x08%x size %d\n",
+                   dref->type, size);
+            entries--;
+            i--;
         }
         avio_seek(pb, next, SEEK_SET);
     }