[FFmpeg-devel] [PATCH] matroskadec: fix NULL pointer dereference in webm_dash_manifest_read_header

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Tue Nov 8 01:44:56 EET 2016


The code assumes that s->streams[0] is valid.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavformat/matroskadec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 32f5e49..130d92e 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3772,6 +3772,11 @@ 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) {
+        matroska_read_close(s);
+        av_log(s, AV_LOG_ERROR, "No streams found\n");
+        return AVERROR_INVALIDDATA;
+    }
 
     if (!matroska->is_live) {
         buf = av_asprintf("%g", matroska->duration);
-- 
2.10.2


More information about the ffmpeg-devel mailing list