diff mbox series

[FFmpeg-devel] libavformat/dashdec.c Fix for ticket #7395

Message ID 1139151377.20231207083240@mail.ru
State New
Headers show
Series [FFmpeg-devel] libavformat/dashdec.c Fix for ticket #7395 | expand

Checks

Context Check Description
yinshiyou/commit_msg_loongarch64 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/commit_msg_x86 warning The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ".
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Evgeniy Pantyuhin Dec. 6, 2023, 8:32 p.m. UTC
Signed-off-by: Evgeniy <pntxn@mail.ru>
---
 libavformat/dashdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Liu Dec. 7, 2023, 3:56 a.m. UTC | #1
Evgeniy Pantyuhin via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
于2023年12月7日周四 04:32写道:
>
> Signed-off-by: Evgeniy <pntxn@mail.ru>
> ---
>  libavformat/dashdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 29d4680..36e4719 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -768,7 +768,7 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur
>      baseurl = xmlNodeGetContent(node);
>      root_url = (av_strcasecmp(baseurl, "")) ? baseurl : path;
>      if (node) {
> -        xmlNodeSetContent(node, root_url);
> +        xmlNodeSetContent(node, xmlEncodeEntitiesReentrant(NULL, root_url));
>          updated = 1;
>      }
>
> --
> 2.40.0.windows.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".


LGTM
Thanks
Steven
Anton Khirnov Dec. 7, 2023, 8:32 a.m. UTC | #2
>libavformat/dashdec.c Fix for ticket #7395

"fix bug" is not a useful commit message
Evgeniy Pantyuhin Dec. 7, 2023, 10:01 p.m. UTC | #3
Hello Anton,

Thursday, December 7, 2023, 8:32:33 PM, you wrote:

>>libavformat/dashdec.c Fix for ticket #7395

> "fix bug" is not a useful commit message


DASH demuxing error "unterminated entity reference" due to ampersand in URL

Commit 7a63da8 broke the DASH demuxer if the manifest contains a BaseURL with an ampersand (&amp;) or other characters that need to be escaped in XML.
This is because the method resolve_content_path calls xmlNodeGetContent, which unescapes the string, and then passes it back to xmlNodeSetContent, which apparently expects an escaped string.
Unfortunately I cannot provide an example MPD, but it should be easy enough to manufacture one by simply adding &amp;v=3 or so to the BaseURL in a simple manifest.
diff mbox series

Patch

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 29d4680..36e4719 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -768,7 +768,7 @@  static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur
     baseurl = xmlNodeGetContent(node);
     root_url = (av_strcasecmp(baseurl, "")) ? baseurl : path;
     if (node) {
-        xmlNodeSetContent(node, root_url);
+        xmlNodeSetContent(node, xmlEncodeEntitiesReentrant(NULL, root_url));
         updated = 1;
     }