mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Test for quadratic backtracking on invalid time
https://hackerone.com/reports/1485501
This commit is contained in:
parent
2cb830602f
commit
be9026a7b4
1 changed files with 9 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue