diff mbox

[FFmpeg-devel,6/8] avformat/matroskadec: Use right number of tracks

Message ID 20190905201609.998-6-andreas.rheinhardt@gmail.com
State Superseded
Headers show

Commit Message

Andreas Rheinhardt Sept. 5, 2019, 8:16 p.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index e5c7a6b29d..075ed63f00 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -4194,7 +4194,7 @@  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");
         return AVERROR_INVALIDDATA;