1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

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@gmail.com>
(cherry picked from commit 1ef30571a0)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2019-08-30 15:18:29 +02:00
parent 325498af97
commit 7e8ce331a0

View File

@ -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) {
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;
}