[FFmpeg-cvslog] avformat/matroskadec: Use right number of tracks

Andreas Rheinhardt git at videolan.org
Thu Jul 2 03:34:02 EEST 2020

ffmpeg | branch: release/4.1 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Aug 30 15:18:29 2019 +0200| [7e8ce331a0f19ac9bbf39085a41d580eb8244b9d] | committer: Andreas Rheinhardt

avformat/matroskadec: Use right number of tracks

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>
(cherry picked from commit 1ef30571a0a7150cb20c580bfc52af2a7101c20d)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e8ce331a0f19ac9bbf39085a41d580eb8244b9d

 libavformat/matroskadec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9f7d76f8ac..78a463ba4f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3964,9 +3964,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) {
-        av_log(s, AV_LOG_ERROR, "No streams found\n");
+        av_log(s, AV_LOG_ERROR, "No track found\n");
         return AVERROR_INVALIDDATA;

More information about the ffmpeg-cvslog mailing list