[ruby/time] Test for quadratic backtracking on invalid time
https://hackerone.com/reports/1485501 https://github.com/ruby/time/commit/b30b7bc6e6
This commit is contained in:
parent
f5b824c745
commit
623027bf0b
@ -62,6 +62,15 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
|
|||||||
assert_equal(true, t.utc?)
|
assert_equal(true, t.utc?)
|
||||||
end
|
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
|
||||||
|
|
||||||
if defined?(Ractor)
|
if defined?(Ractor)
|
||||||
def test_rfc2822_ractor
|
def test_rfc2822_ractor
|
||||||
assert_ractor(<<~RUBY, require: 'time')
|
assert_ractor(<<~RUBY, require: 'time')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user