]> git.sesse.net Git - ffmpeg/commitdiff
avformat/matroskadec: Use right number of tracks
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 30 Aug 2019 13:18:29 +0000 (15:18 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 15 Jun 2020 14:15:47 +0000 (16:15 +0200)
When demuxing a Matroska/WebM file, streams are added for tracks and for
attachments, so that the array containing the former can be NULL even
when the corresponding AVFormatContext has streams. So check for there
to be tracks in the MatroskaDemuxContext instead of just streams in the
AVFormatContext before dereferencing the pointer to the tracks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskadec.c

index 1846b1f93ce166ee23d19fb007f8fc2810f8b04d..2f71ae2a65d70615d69f1cb8816a289be4c78770 100644 (file)
@@ -4180,9 +4180,9 @@ static int webm_dash_manifest_read_header(AVFormatContext *s)
         av_log(s, AV_LOG_ERROR, "Failed to read file headers\n");
         return -1;
     }
-    if (!s->nb_streams) {
+    if (!matroska->tracks.nb_elem || !s->nb_streams) {
         matroska_read_close(s);
-        av_log(s, AV_LOG_ERROR, "No streams found\n");
+        av_log(s, AV_LOG_ERROR, "No track found\n");
         return AVERROR_INVALIDDATA;
     }