[前][次][番号順一覧][スレッド一覧]

ruby-changes:32007

From: nobu <ko1@a...>
Date: Mon, 9 Dec 2013 11:14:42 +0900 (JST)
Subject: [ruby-changes:32007] nobu:r44086 (trunk): date_parse.c: get rid of backtrack explosion

nobu	2013-12-09 11:14:35 +0900 (Mon, 09 Dec 2013)

  New Revision: 44086

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44086

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_parse.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44085)
+++ ChangeLog	(revision 44086)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec  9 11:14:26 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@s...>
 
 	* lib/rubygems:  Update to RubyGems master bf37240.  Fixes useless
Index: ext/date/date_parse.c
===================================================================
--- ext/date/date_parse.c	(revision 44085)
+++ ext/date/date_parse.c	(revision 44086)
@@ -765,9 +765,9 @@ parse_time(VALUE str, VALUE hash) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L765
 		   "("
 		     "(?: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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]