Sfoglia il codice sorgente

avformat/dashdec: Fix urls with special characters in manifest

This was especially a problem with ampersands, which occur
frequently as part of query parameters.
Hendi 2 settimane fa
parent
commit
b399896046
1 ha cambiato i file con 15 aggiunte e 3 eliminazioni
  1. 15 3
      libavformat/dashdec.c

+ 15 - 3
libavformat/dashdec.c

@@ -780,7 +780,13 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur
     }
     root_url = (av_strcasecmp(baseurl, "")) ? baseurl : path;
     if (node) {
-        xmlNodeSetContent(node, root_url);
+        xmlChar *escaped = xmlEncodeSpecialChars(NULL, root_url);
+        if (!escaped) {
+            updated = AVERROR(ENOMEM);
+            goto end;
+        }
+        xmlNodeSetContent(node, escaped);
+        xmlFree(escaped);
         updated = 1;
     }
 
@@ -814,9 +820,15 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur
                 memset(p + 1, 0, strlen(p));
             }
             av_strlcat(tmp_str, text + start, tmp_max_url_size);
-            xmlNodeSetContent(baseurl_nodes[i], tmp_str);
-            updated = 1;
             xmlFree(text);
+            xmlChar* escaped = xmlEncodeSpecialChars(NULL, tmp_str);
+            if (!escaped) {
+                updated = AVERROR(ENOMEM);
+                goto end;
+            }
+            xmlNodeSetContent(baseurl_nodes[i], escaped);
+            updated = 1;
+            xmlFree(escaped);
         }
     }