From patchwork Mon Jul 27 13:07:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 21289 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 33CE944A60F for ; Mon, 27 Jul 2020 16:08:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1EA0468B837; Mon, 27 Jul 2020 16:08:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbguseast2.qq.com (smtpbguseast2.qq.com [54.204.34.130]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4272268B6E6 for ; Mon, 27 Jul 2020 16:08:29 +0300 (EEST) X-QQ-mid: bizesmtp6t1595855287t3wsr8weq Received: from localhost (unknown [103.107.216.232]) by esmtp6.qq.com (ESMTP) with id ; Mon, 27 Jul 2020 21:08:07 +0800 (CST) X-QQ-SSF: 01100000002000Z0ZXF0B00A0000000 X-QQ-FEAT: WX1oBb0zbX23tqlV0NVVrM9VFJD8hs9MUMJ5WonaZe6s64wfWH8zE24BCzh7b 5uMTuq6HxacoII+LqRRHAey91zHVKChSAZICkpcAcz0U5TI10J1teqbKPeBcVIqsk01K2Ma h/ZGEtpYBMKW4dDaSUPGF8EF9a01VnF++XqS4riViaC2floczegU3QAJIliNRPeTuMY+H79 +7EdJjR7kmxya8gDZGb4Ko01zUgA1JUAEtTpbRlSYdNTK13E6ps8rZgVYmSMqgBLTVkSMbV h15IyqNrtqsdS3GUx3kAfADrd6SJ81602/nGi9VL4qfg6WN1juDHXbEYSYApqcGJ15tjG/S MOuoe3A X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Jul 2020 21:07:48 +0800 Message-Id: <20200727130748.90906-2-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200727130748.90906-1-lq@chinaffmpeg.org> References: <20200727130748.90906-1-lq@chinaffmpeg.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH v3 2/2] avformat/tests/url: add test cases for .. and last node is .. 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: Steven Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Steven Liu --- libavformat/tests/url.c | 14 ++++++++++++++ tests/ref/fate/url | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c index 1d961a1b43..0de511caf9 100644 --- a/libavformat/tests/url.c +++ b/libavformat/tests/url.c @@ -24,6 +24,8 @@ static void test(const char *base, const char *rel) { char buf[200], buf2[200]; + memset(buf, 0, 200); + memset(buf2, 0, 200); ff_make_absolute_url(buf, sizeof(buf), base, rel); printf("%50s %-20s => %s\n", base, rel, buf); if (base) { @@ -66,7 +68,19 @@ int main(void) test("http://server/foo/bar?param=value/with/slashes", "/baz"); 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", "other/url"); test("http://server/foo/bar", "../../../../../other/url"); + test("http://server/foo/bar", "../../../../../other/url/test..mp3"); + test("http://server/foo/bar", "../../../../../other/url/test.."); + test("http://server/foo/bar", "../../../../../other/url/test/..."); + test("http://server/foo/bar", "../../../../../other/url/.../test/out"); + test("http://server/foo/bar", "../../../../../other/url/.../../test/out"); + test("http://server/foo/bar", "../../../../../other/url/.../..test/out"); + test("http://server/foo/bar", "../../../../../other/url/.."); + test("http://server/foo/bar", "../../../../../other/url/..mp3"); + test("http://server/foo/bar", "../../../../../other/url/..test/mp3"); + test("http://server/foo/bar", "../../../../../other/url/test../mp3"); 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..35eee25f4a 100644 --- a/tests/ref/fate/url +++ b/tests/ref/fate/url @@ -13,7 +13,19 @@ Testing ff_make_absolute_url: http://server/foo/bar?param=value/with/slashes /baz => http://server/baz 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 other/url => http://server/foo/other/url http://server/foo/bar ../../../../../other/url => http://server/other/url + http://server/foo/bar ../../../../../other/url/test..mp3 => http://server/other/url/test..mp3 + http://server/foo/bar ../../../../../other/url/test.. => http://server/other/url/test.. + http://server/foo/bar ../../../../../other/url/test/... => http://server/other/url/test/... + http://server/foo/bar ../../../../../other/url/.../test/out => http://server/other/url/.../test/out + http://server/foo/bar ../../../../../other/url/.../../test/out => http://server/other/url/test/out + http://server/foo/bar ../../../../../other/url/.../..test/out => http://server/other/url/.../..test/out + http://server/foo/bar ../../../../../other/url/.. => http://server/other + http://server/foo/bar ../../../../../other/url/..mp3 => http://server/other/url/..mp3 + http://server/foo/bar ../../../../../other/url/..test/mp3 => http://server/other/url/..test/mp3 + http://server/foo/bar ../../../../../other/url/test../mp3 => http://server/other/url/test../mp3 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