diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-29 16:22:15 +0900 |
---|---|---|
committer | usa <usa@garbagecollect.jp> | 2023-03-30 19:48:27 +0900 |
commit | be9026a7b4d2c3a6bd7f109334149f4da08cf43f (patch) | |
tree | 5a556b95ae717e4951aa0787ba8d7208475887a1 | |
parent | 2cb830602f52e7e76c6781115e7938b21f881c4f (diff) |
Test for quadratic backtracking on invalid time
https://hackerone.com/reports/1485501
-rw-r--r-- | test/test_time.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_time.rb b/test/test_time.rb index ca20788aac..4f11048596 100644 --- a/test/test_time.rb +++ b/test/test_time.rb @@ -62,6 +62,15 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc: assert_equal(true, t.utc?) end + def test_rfc2822_nonlinear + pre = ->(n) {"0 Feb 00 00 :00" + " " * n} + assert_linear_performance([100, 500, 5000, 50_000], pre: pre) do |s| + assert_raise(ArgumentError) do + Time.rfc2822(s) + end + end + end + def test_encode_rfc2822 t = Time.utc(1) assert_equal("Mon, 01 Jan 0001 00:00:00 -0000", t.rfc2822) |