[FFmpeg-devel] [PATCH] libavformat/utils.c: Fixed URL parsing

gautamramk at gmail.com gautamramk at gmail.com
Wed Feb 12 20:12:30 EET 2020


From: Gautam Ramakrishnan <gautamramk at gmail.com>

This commit fixes bug #8466 wherein URLs with query string
not preceeded by the '/' symbol in a URL was failing to get
parsed. The av_url_split() function now checks if the path
starts with a '/' and prepends it if it does not.
---
 libavformat/utils.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 81ea239a66..a14d4ef90d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4819,6 +4819,13 @@ void av_url_split(char *proto, int proto_size,
         av_strlcpy(path, ls, path_size);
     else
         ls = &p[strlen(p)];  // XXX
+    /* if path does not start with a /, prepend a / */
+    if (path[0] != '/') {
+        char temp[1024];
+        av_strlcpy(temp, path, path_size);
+        path[0] = '/';
+        av_strlcpy(path + 1, temp, path_size - 1);
+    }
 
     /* the rest is hostname, use that to parse auth/port */
     if (ls != p) {
-- 
2.17.1



More information about the ffmpeg-devel mailing list