[FFmpeg-devel] [PATCH 03/26] avformat/matroskadec: Use right number of tracks

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Mon Jun 15 01:36:33 EEST 2020


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 at gmail.com>
---
 libavformat/matroskadec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 1846b1f93c..d26375cdcc 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -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) {
         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;
     }
 
-- 
2.20.1



More information about the ffmpeg-devel mailing list