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

ruby-changes:32047

From: nobu <ko1@a...>
Date: Tue, 10 Dec 2013 23:58:49 +0900 (JST)
Subject: [ruby-changes:32047] nobu:r44126 (trunk): date_strptime.c: get rid of backtrack explosion

nobu	2013-12-10 23:58:43 +0900 (Tue, 10 Dec 2013)

  New Revision: 44126

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

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

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_strptime.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44125)
+++ ChangeLog	(revision 44126)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec 10 23:58:30 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/date/date_strptime.c (date__strptime_internal): unset
+	  case-insensitive flag for [:alpha:], which already implies both
+	  cases, to get rid of backtrack explosion.  [ruby-core:58984]
+	  [Bug #9221]
+
 Tue Dec 10 23:44:42 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* array.c (rb_ary_hash): add salt to differentiate false and empty
Index: ext/date/date_strptime.c
===================================================================
--- ext/date/date_strptime.c	(revision 44125)
+++ ext/date/date_strptime.c	(revision 44126)
@@ -567,8 +567,8 @@ date__strptime_internal(const char *str, https://github.com/ruby/ruby/blob/trunk/ext/date/date_strptime.c#L567
 		    static const char pat_source[] =
 			"\\A("
 			"(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
-			"|[[:alpha:].\\s]+(?:standard|daylight)\\s+time\\b"
-			"|[[:alpha:]]+(?:\\s+dst)?\\b"
+			"|(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\s+time\\b"
+			"|(?-i:[[:alpha:]]+)(?:\\s+dst)?\\b"
 			")";
 		    static VALUE pat = Qnil;
 		    VALUE m, b;

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

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