From patchwork Mon Jul 27 12:14:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zlomek, Josef" X-Patchwork-Id: 21285 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EB426447F6E for ; Mon, 27 Jul 2020 15:15:05 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CCF9468B833; Mon, 27 Jul 2020 15:15:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vps.zlomek.net (vps.zlomek.net [195.181.211.90]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BA17768B7CF for ; Mon, 27 Jul 2020 15:14:59 +0300 (EEST) Received: by vps.zlomek.net (Postfix, from userid 1000) id 3B2F65FE59; Mon, 27 Jul 2020 14:14:59 +0200 (CEST) From: Josef Zlomek To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Jul 2020 14:14:57 +0200 Message-Id: <20200727121457.7500-2-josef@pex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200727121457.7500-1-josef@pex.com> References: <20200727121457.7500-1-josef@pex.com> Subject: [FFmpeg-devel] [PATCH v2 2/2] avformat/tests/url: add test cases for handling of double dot X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Josef Zlomek MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Josef Zlomek --- 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