date_parse.c: get rid of backtrack explosion

* ext/date/date_parse.c (parse_time): unset case-insensitive flag
  for [:alpha:], which already implies both cases, to get rid of
  backtrack explosion.  [ruby-core:58876] [Bug #9221]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-12-09 02:14:35 +00:00
parent 05ba6fffcc
commit 334294d0e2
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
Mon Dec 9 11:14:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/date/date_parse.c (parse_time): unset case-insensitive flag
for [:alpha:], which already implies both cases, to get rid of
backtrack explosion. [ruby-core:58876] [Bug #9221]
Mon Dec 9 08:40:40 2013 Eric Hodel <drbrain@segment7.net> Mon Dec 9 08:40:40 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems: Update to RubyGems master bf37240. Fixes useless * lib/rubygems: Update to RubyGems master bf37240. Fixes useless

View File

@ -765,9 +765,9 @@ parse_time(VALUE str, VALUE hash)
"(" "("
"(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?" "(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
"|" "|"
"[[:alpha:].\\s]+(?:standard|daylight)\\stime\\b" "(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\stime\\b"
"|" "|"
"[[:alpha:]]+(?:\\sdst)?\\b" "(?-i:[[:alpha:]]+)(?:\\sdst)?\\b"
")" ")"
")?"; ")?";
static VALUE pat = Qnil; static VALUE pat = Qnil;