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

Josef Zlomek josef at pex.com
Mon Jul 27 15:14:57 EEST 2020


Signed-off-by: Josef Zlomek <josef at 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



More information about the ffmpeg-devel mailing list