зеркало из https://github.com/github/ruby.git
[ruby/date] Anchor at beginning of numbers
https://hackerone.com/reports/1254844 https://github.com/ruby/date/commit/2f7814cc22
This commit is contained in:
Родитель
1758eade57
Коммит
b5c2a0840f
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
Загрузка…
Ссылка в новой задаче