diff mbox series

[FFmpeg-devel,3/3] avformat/matroskadec: Allow multiple Tags elements

Message ID 20200501005522.16402-3-andreas.rheinhardt@gmail.com
State Accepted
Commit ff4da60fb8d849f709295bcdcb67726ea189d62b
Headers show
Series [FFmpeg-devel,1/3] avformat/matroskadec: Sanitize SeekHead entries
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 1, 2020, 12:55 a.m. UTC
The Matroska specification allows multiple (level 1) Tags elements per
file, yet our demuxer didn't: While it parsed any amount of Tags
elements it found in front of the Clusters (albeit with warnings because
of duplicate elements), it would treat any Tags element only referenced
via a SeekHead entry as already parsed if any Tags element has already
been parsed; therefore this Tags element would not be parsed at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/matroskadec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 25eed210c5..aede93d994 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1146,11 +1146,11 @@  static MatroskaLevel1Element *matroska_find_level1_elem(MatroskaDemuxContext *ma
     if (id == MATROSKA_ID_CLUSTER)
         return NULL;
 
-    // There can be multiple seekheads.
+    // There can be multiple SeekHeads and Tags.
     for (i = 0; i < matroska->num_level1_elems; i++) {
         if (matroska->level1_elems[i].id == id) {
             if (matroska->level1_elems[i].pos == pos ||
-                id != MATROSKA_ID_SEEKHEAD)
+                id != MATROSKA_ID_SEEKHEAD && id != MATROSKA_ID_TAGS)
                 return &matroska->level1_elems[i];
         }
     }