1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/date] Anchor at beginning of numbers

https://hackerone.com/reports/1254844

https://github.com/ruby/date/commit/2f7814cc22
This commit is contained in:
Nobuyoshi Nakada 2021-07-09 07:21:27 +09:00 committed by git
parent 1758eade57
commit b5c2a0840f
2 changed files with 6 additions and 1 deletions

View file

@ -980,7 +980,7 @@ parse_iso(VALUE str, VALUE hash)
{
static const char pat_source[] =
#ifndef TIGHT_PARSER
"('?[-+]?\\d+)-(\\d+)-('?-?\\d+)"
"('?[-+]?" NUMBER "+)-(\\d+)-('?-?\\d+)"
#else
BOS
FPW_COM FPT_COM

View file

@ -590,6 +590,11 @@ class TestDateParse < Test::Unit::TestCase
h = Timeout.timeout(1) {Date._parse(str)}
assert_equal(100_000, Math.log10(h[:year]))
assert_equal(1, h[:mon])
str = "Jan - 1" + "0" * 100_000
h = Timeout.timeout(1) {Date._parse(str)}
assert_equal(1, h[:mon])
assert_not_include(h, :year)
end
require 'time'