Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Hendi48 via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Hendi48 <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avformat/dashdec: Fix urls with special characters in manifest (PR #20823)
Date: Sun, 02 Nov 2025 22:17:26 -0000
Message-ID: <176212184715.25.548743367229097133@2cb04c0e5124> (raw)

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

                 reply	other threads:[~2025-11-02 22:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176212184715.25.548743367229097133@2cb04c0e5124 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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