[FFmpeg-devel] [PATCH v2] lavf/url: fix rel path’s query string contains :/

Marton Balint cus at passwd.hu
Sat Oct 17 11:35:17 EEST 2020



On Sat, 17 Oct 2020, caihaoning83 at gmail.com wrote:

> From: "ruiquan.crq" <caihaoning83 at gmail.com>
>
> Signed-off-by: ruiquan.crq <caihaoning83 at gmail.com>
> ---
> libavformat/tests/url.c | 1 +
> libavformat/url.c       | 2 +-
> tests/ref/fate/url      | 4 ++++
> 3 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c
> index 2440ae08bc..c294795fa2 100644
> --- a/libavformat/tests/url.c
> +++ b/libavformat/tests/url.c
> @@ -90,6 +90,7 @@ int main(void)
>     test_decompose("http://[::1]/dev/null");
>     test_decompose("http://[::1]:8080/dev/null");
>     test_decompose("//ffmpeg/dev/null");
> +    test_decompose("test?url=http://server/path");
>
>     printf("Testing ff_make_absolute_url:\n");
>     test(NULL, "baz");
> diff --git a/libavformat/url.c b/libavformat/url.c
> index 3c858f0257..da5950723e 100644
> --- a/libavformat/url.c
> +++ b/libavformat/url.c
> @@ -97,7 +97,7 @@ int ff_url_decompose(URLComponents *uc, const char *url, const char *end)
>
>     /* scheme */
>     uc->scheme = cur;
> -    p = find_delim(":/", cur, end); /* lavf "schemes" can contain options */
> +    p = find_delim(":/?", cur, end); /* lavf "schemes" can contain options, or "schemes" can't contains characters['?']*/

And why not also add # here as well? With the same logic, there can be 
URL-s like dummy.mp4#t=0:02:00,121.5 and they will fail currently.

Also a more clear wording for the comment:
/* lavf "schemes" can contain options but not some RFC 3986 delimiters */

Regards,
Marton

>     if (*p == ':')
>         cur = p + 1;
> 
> diff --git a/tests/ref/fate/url b/tests/ref/fate/url
> index 7e6395c47b..a9db0251f1 100644
> --- a/tests/ref/fate/url
> +++ b/tests/ref/fate/url
> @@ -43,6 +43,10 @@ http://[::1]:8080/dev/null =>
>   host: ffmpeg
>   path: /dev/null
> 
> +test?url=http://server/path =>
> +  path: test
> +  query: ?url=http://server/path
> +
> Testing ff_make_absolute_url:
>                                             (null) baz                  => baz
>                                           /foo/bar baz                  => /foo/baz
> -- 
> 2.24.1 (Apple Git-126)
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list