matroskadec: fix NULL pointer dereference in webm_dash_manifest_read_header
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Mon, 7 Nov 2016 23:42:23 +0000 (00:42 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Thu, 17 Nov 2016 22:14:52 +0000 (23:14 +0100)
The code assumes that s->streams[0] is valid.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit ff100c9dd97d2f1f456ff38b192edf84f9744738)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/matroskadec.c

index 32f5e49..130d92e 100644 (file)
@@ -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);