PR #20823 opened by Hendi48 URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20823 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20823.patch
This fixes a long standing bug where URLs with multiple query parameters broke the DASH manifest parser. libxml2 will decode entities when fetching node content, but when setting it back with `xmlNodeSetContent`, it's the caller's responsibility to ensure special chars like ampersands are encoded. Fixes trac https://trac.ffmpeg.org/ticket/7395 >From eb58d8deccff900f11e03874e64ed7632d28cd97 Mon Sep 17 00:00:00 2001 From: Hendi <[email protected]> Date: Sun, 2 Nov 2025 23:11:02 +0100 Subject: [PATCH] avformat/dashdec: Fix urls with special characters in manifest This was especially a problem with ampersands, which occur frequently as part of query parameters. --- libavformat/dashdec.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 1f59d3a41c..9b52f24564 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -709,6 +709,7 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur char *path = NULL; char *mpdName = NULL; xmlNodePtr node = NULL; + xmlChar *escaped = NULL; char *baseurl = NULL; char *root_url = NULL; char *text = NULL; @@ -780,7 +781,9 @@ 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); + escaped = xmlEncodeSpecialChars(NULL, root_url); + xmlNodeSetContent(node, escaped); + free(escaped); updated = 1; } @@ -814,8 +817,10 @@ 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); + escaped = xmlEncodeSpecialChars(NULL, tmp_str); + xmlNodeSetContent(baseurl_nodes[i], escaped); updated = 1; + xmlFree(escaped); xmlFree(text); } } -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
