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

ruby-changes:43281

From: usa <ko1@a...>
Date: Fri, 10 Jun 2016 16:11:49 +0900 (JST)
Subject: [ruby-changes:43281] usa:r55355 (ruby_2_2): merge revision(s) 55154: [Backport #12418]

usa	2016-06-10 16:11:45 +0900 (Fri, 10 Jun 2016)

  New Revision: 55355

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55355

  Log:
    merge revision(s) 55154: [Backport #12418]
    
    * regcomp.c (compile_length_tree): return error code immediately
      if compile_length_tree raised error [Bug #12418]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/regcomp.c
    branches/ruby_2_2/test/ruby/test_regexp.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/test/ruby/test_regexp.rb
===================================================================
--- ruby_2_2/test/ruby/test_regexp.rb	(revision 55354)
+++ ruby_2_2/test/ruby/test_regexp.rb	(revision 55355)
@@ -1005,6 +1005,9 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_regexp.rb#L1005
     conds = {"xy"=>true, "yx"=>true, "xx"=>false, "yy"=>false}
     assert_match_each(/\A((x)|(y))(?(2)y|x)\z/, conds, bug8583)
     assert_match_each(/\A((?<x>x)|(?<y>y))(?(<x>)y|x)\z/, conds, bug8583)
+
+    bug12418 = '[ruby-core:75694] [Bug #12418]'
+    assert_raise(RegexpError, bug12418){ Regexp.new('(0?0|(?(5)||)|(?(5)||))?') }
   end
 
   def test_options_in_look_behind
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 55354)
+++ ruby_2_2/version.h	(revision 55355)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.6"
 #define RUBY_RELEASE_DATE "2016-06-10"
-#define RUBY_PATCHLEVEL 330
+#define RUBY_PATCHLEVEL 331
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_2/regcomp.c
===================================================================
--- ruby_2_2/regcomp.c	(revision 55354)
+++ ruby_2_2/regcomp.c	(revision 55355)
@@ -1592,13 +1592,15 @@ compile_length_tree(Node* node, regex_t* https://github.com/ruby/ruby/blob/trunk/ruby_2_2/regcomp.c#L1592
 
   case NT_ALT:
     {
-      int n;
-
-      n = r = 0;
+      int n = 0;
+      len = 0;
       do {
-	r += compile_length_tree(NCAR(node), reg);
-	n++;
+        r = compile_length_tree(NCAR(node), reg);
+        if (r < 0) return r;
+        len += r;
+        n++;
       } while (IS_NOT_NULL(node = NCDR(node)));
+      r = len;
       r += (SIZE_OP_PUSH + SIZE_OP_JUMP) * (n - 1);
     }
     break;
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 55354)
+++ ruby_2_2/ChangeLog	(revision 55355)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Fri Jun 10 16:10:23 2016  NARUSE, Yui  <naruse@r...>
+
+	* regcomp.c (compile_length_tree): return error code immediately
+	  if compile_length_tree raised error [Bug #12418]
+
 Fri Jun 10 16:06:25 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/missing.h (isfinite): move from numeric.c.

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r55154


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

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