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

Marton Balint cus at passwd.hu
Wed Feb 12 21:01:03 EET 2020



On Wed, 12 Feb 2020, gautamramk at gmail.com wrote:

> 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);
> +    }

I made a patch which fixes this in the HTTP protocol, as modifying the 
empty path to / is a HTTP requirement, other protocols might not need 
this.

http://mplayerhq.hu/pipermail/ffmpeg-devel/2020-February/256902.html

Regards,
Marton


More information about the ffmpeg-devel mailing list