summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-04-22 20:09:10 +0900
committergit <svn-admin@ruby-lang.org>2023-06-29 01:07:52 +0000
commit995ce947bed7e92bcda185f164d43089e6a1cf5e (patch)
tree6ce30847e79472789688403c9306cc137da00dec /test
parent1eff362492f4a0ca8d6d036c958afa7961e827f0 (diff)
[ruby/uri] Fix quadratic backtracking on invalid port number
https://hackerone.com/reports/1958260 https://github.com/ruby/uri/commit/9d7bcef1e6
Diffstat (limited to 'test')
-rw-r--r--test/uri/test_parser.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/uri/test_parser.rb b/test/uri/test_parser.rb
index 55abe2c583..75c02fe65b 100644
--- a/test/uri/test_parser.rb
+++ b/test/uri/test_parser.rb
@@ -99,4 +99,14 @@ class URI::TestParser < Test::Unit::TestCase
end
end
end
+
+ def test_rfc3986_port_check
+ pre = ->(length) {"\t" * length + "a"}
+ uri = URI.parse("http://my.example.com")
+ assert_linear_performance((1..5).map {|i| 10**i}, pre: pre) do |port|
+ assert_raise(URI::InvalidComponentError) do
+ uri.port = port
+ end
+ end
+ end
end