aboutsummaryrefslogtreecommitdiffstats
path: root/test/date
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-07-09 07:21:27 +0900
committergit <svn-admin@ruby-lang.org>2022-02-25 19:52:31 +0900
commit1758eade579c91f9ad000943994fccf30c7bf8a0 (patch)
tree21d9d96c0e602523b420144cc8a7e8fcfdc92789 /test/date
parentd54a3df2e53a964c8bb36b87bc10ba2512830a60 (diff)
downloadruby-1758eade579c91f9ad000943994fccf30c7bf8a0.tar.gz
[ruby/date] Anchor at beginning of numbers
https://hackerone.com/reports/1254844 https://github.com/ruby/date/commit/7ffe25e458
Diffstat (limited to 'test/date')
-rw-r--r--test/date/test_date_parse.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index 34a672b069..a87b165080 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -585,6 +585,13 @@ class TestDateParse < Test::Unit::TestCase
assert_equal(5025, h[:offset])
end
+ def test__parse_too_long_year
+ str = "Jan 1" + "0" * 100_000
+ h = Timeout.timeout(1) {Date._parse(str)}
+ assert_equal(100_000, Math.log10(h[:year]))
+ assert_equal(1, h[:mon])
+ end
+
require 'time'
def test_parse__time