smoothstreaming: Handle invalid XML
authorEdward Hervey <edward@centricular.com>
Tue, 21 Nov 2017 14:33:57 +0000 (15:33 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Tue, 21 Nov 2017 14:33:57 +0000 (15:33 +0100)
Nothing guarantees the manifest is valid and will return a root node

ext/smoothstreaming/gstmssmanifest.c

index 2085b36..c855cb3 100644 (file)
@@ -354,6 +354,11 @@ gst_mss_manifest_new (GstBuffer * data)
   manifest->xml = xmlReadMemory ((const gchar *) mapinfo.data,
       mapinfo.size, "manifest", NULL, 0);
   root = manifest->xmlrootnode = xmlDocGetRootElement (manifest->xml);
+  if (root == NULL) {
+    GST_WARNING ("No root node ! Invalid manifest");
+    gst_mss_manifest_free (manifest);
+    return NULL;
+  }
 
   live_str = (gchar *) xmlGetProp (root, (xmlChar *) "IsLive");
   if (live_str) {