Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/dashdec: Fix urls with special characters in manifest (PR #20823)
@ 2025-11-02 22:17 Hendi48 via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: Hendi48 via ffmpeg-devel @ 2025-11-02 22:17 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Hendi48

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 <hendi48@freenet.de>
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-02 22:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-02 22:17 [FFmpeg-devel] [PATCH] avformat/dashdec: Fix urls with special characters in manifest (PR #20823) Hendi48 via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git