diff mbox series

[FFmpeg-devel,v2,2/2] avformat/tests/url: add test cases for handling of double dot

Message ID 20200727121457.7500-2-josef@pex.com
State Superseded
Headers show
Series [FFmpeg-devel,v2,1/2] avformat/url: fix logic for removing ".." path components | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Zlomek, Josef July 27, 2020, 12:14 p.m. UTC
Signed-off-by: Josef Zlomek <josef@pex.com>
---
 libavformat/tests/url.c | 6 ++++++
 tests/ref/fate/url      | 6 ++++++
 2 files changed, 12 insertions(+)

Comments

Steven Liu July 28, 2020, 1:11 a.m. UTC | #1
Josef Zlomek <josef@pex.com> 于2020年7月27日周一 下午8:15写道:
>
> Signed-off-by: Josef Zlomek <josef@pex.com>
> ---
>  libavformat/tests/url.c | 6 ++++++
>  tests/ref/fate/url      | 6 ++++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c
> index 1d961a1b43..a27a875892 100644
> --- a/libavformat/tests/url.c
> +++ b/libavformat/tests/url.c
> @@ -57,6 +57,8 @@ int main(void)
>      test("/foo/bar", "../baz");
>      test("/foo/bar", "/baz");
>      test("/foo/bar", "../../../baz");
> +    test("/foo/bar", "..");
> +    test("/foo/bar/baz", "..");
>      test("http://server/foo/", "baz");
>      test("http://server/foo/bar", "baz");
>      test("http://server/foo/", "../baz");
> @@ -67,6 +69,10 @@ int main(void)
>      test("http://server/foo/bar?param&otherparam", "?someparam");
>      test("http://server/foo/bar", "//other/url");
>      test("http://server/foo/bar", "../../../../../other/url");
> +    test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/test..mp3");
> +    test("http://server/foo/bar", "/a/b/../c/d/../e../..f/.../other/url/test..mp3");
> +    test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/..");
> +    test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/");
>      test("http://server/foo/bar", "/../../../../../other/url");
>      test("http://server/foo/bar", "/test/../../../../../other/url");
>      test("http://server/foo/bar", "/test/../../test/../../../other/url");
> diff --git a/tests/ref/fate/url b/tests/ref/fate/url
> index 533ba2cb1e..aa53e09fab 100644
> --- a/tests/ref/fate/url
> +++ b/tests/ref/fate/url
> @@ -4,6 +4,8 @@ Testing ff_make_absolute_url:
>                                            /foo/bar ../baz               => /baz
>                                            /foo/bar /baz                 => /baz
>                                            /foo/bar ../../../baz         => /baz
> +                                          /foo/bar ..                   => /
> +                                      /foo/bar/baz ..                   => /foo/
>                                  http://server/foo/ baz                  => http://server/foo/baz
>                               http://server/foo/bar baz                  => http://server/foo/baz
>                                  http://server/foo/ ../baz               => http://server/baz
> @@ -14,6 +16,10 @@ Testing ff_make_absolute_url:
>              http://server/foo/bar?param&otherparam ?someparam           => http://server/foo/bar?someparam
>                               http://server/foo/bar //other/url          => http://other/url
>                               http://server/foo/bar ../../../../../other/url => http://server/other/url
> +                             http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/test..mp3 => http://server/foo/a/c/e../..f/.../other/url/test..mp3
> +                             http://server/foo/bar /a/b/../c/d/../e../..f/.../other/url/test..mp3 => http://server/a/c/e../..f/.../other/url/test..mp3
> +                             http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/.. => http://server/foo/a/c/e../..f/.../other/
> +                             http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/ => http://server/foo/a/c/e../..f/.../other/url/
>                               http://server/foo/bar /../../../../../other/url => http://server/other/url
>                               http://server/foo/bar /test/../../../../../other/url => http://server/other/url
>                               http://server/foo/bar /test/../../test/../../../other/url => http://server/other/url
> --
> 2.17.1
>
Patchiest LGTM,

Will apply after 24 hours if no objections.


Thanks
Steven
Nicolas George July 28, 2020, 7:53 a.m. UTC | #2
Steven Liu (12020-07-28):
> Will apply after 24 hours if no objections.

Please give me time to look at it carefully.

Regards,
diff mbox series

Patch

diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c
index 1d961a1b43..a27a875892 100644
--- a/libavformat/tests/url.c
+++ b/libavformat/tests/url.c
@@ -57,6 +57,8 @@  int main(void)
     test("/foo/bar", "../baz");
     test("/foo/bar", "/baz");
     test("/foo/bar", "../../../baz");
+    test("/foo/bar", "..");
+    test("/foo/bar/baz", "..");
     test("http://server/foo/", "baz");
     test("http://server/foo/bar", "baz");
     test("http://server/foo/", "../baz");
@@ -67,6 +69,10 @@  int main(void)
     test("http://server/foo/bar?param&otherparam", "?someparam");
     test("http://server/foo/bar", "//other/url");
     test("http://server/foo/bar", "../../../../../other/url");
+    test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/test..mp3");
+    test("http://server/foo/bar", "/a/b/../c/d/../e../..f/.../other/url/test..mp3");
+    test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/..");
+    test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/");
     test("http://server/foo/bar", "/../../../../../other/url");
     test("http://server/foo/bar", "/test/../../../../../other/url");
     test("http://server/foo/bar", "/test/../../test/../../../other/url");
diff --git a/tests/ref/fate/url b/tests/ref/fate/url
index 533ba2cb1e..aa53e09fab 100644
--- a/tests/ref/fate/url
+++ b/tests/ref/fate/url
@@ -4,6 +4,8 @@  Testing ff_make_absolute_url:
                                           /foo/bar ../baz               => /baz
                                           /foo/bar /baz                 => /baz
                                           /foo/bar ../../../baz         => /baz
+                                          /foo/bar ..                   => /
+                                      /foo/bar/baz ..                   => /foo/
                                 http://server/foo/ baz                  => http://server/foo/baz
                              http://server/foo/bar baz                  => http://server/foo/baz
                                 http://server/foo/ ../baz               => http://server/baz
@@ -14,6 +16,10 @@  Testing ff_make_absolute_url:
             http://server/foo/bar?param&otherparam ?someparam           => http://server/foo/bar?someparam
                              http://server/foo/bar //other/url          => http://other/url
                              http://server/foo/bar ../../../../../other/url => http://server/other/url
+                             http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/test..mp3 => http://server/foo/a/c/e../..f/.../other/url/test..mp3
+                             http://server/foo/bar /a/b/../c/d/../e../..f/.../other/url/test..mp3 => http://server/a/c/e../..f/.../other/url/test..mp3
+                             http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/.. => http://server/foo/a/c/e../..f/.../other/
+                             http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/ => http://server/foo/a/c/e../..f/.../other/url/
                              http://server/foo/bar /../../../../../other/url => http://server/other/url
                              http://server/foo/bar /test/../../../../../other/url => http://server/other/url
                              http://server/foo/bar /test/../../test/../../../other/url => http://server/other/url