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

ruby-changes:43384

From: nagachika <ko1@a...>
Date: Mon, 20 Jun 2016 02:35:46 +0900 (JST)
Subject: [ruby-changes:43384] nagachika:r55458 (ruby_2_3): merge revision(s) 55163, 55165: [Backport #12420]

nagachika	2016-06-20 02:35:40 +0900 (Mon, 20 Jun 2016)

  New Revision: 55458

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

  Log:
    merge revision(s) 55163,55165: [Backport #12420]
    
    * regparse.c (fetch_token_in_cc): raise error if given octal escaped
      character is too big. [Bug #12420] [Bug #12423]
    
    * re.c (unescape_nonascii): scan hex up to only 3 characters.
      [Bug #12420] [Bug #12423]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/re.c
    branches/ruby_2_3/regparse.c
    branches/ruby_2_3/test/ruby/test_regexp.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/regparse.c
===================================================================
--- ruby_2_3/regparse.c	(revision 55457)
+++ ruby_2_3/regparse.c	(revision 55458)
@@ -3222,7 +3222,7 @@ fetch_token_in_cc(OnigToken* tok, UChar* https://github.com/ruby/ruby/blob/trunk/ruby_2_3/regparse.c#L3222
 	PUNFETCH;
 	prev = p;
 	num = scan_unsigned_octal_number(&p, end, 3, enc);
-	if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
+	if (num < 0 || 0xff < num) return ONIGERR_TOO_BIG_NUMBER;
 	if (p == prev) {  /* can't read nothing. */
 	  num = 0; /* but, it's not error */
 	}
Index: ruby_2_3/test/ruby/test_regexp.rb
===================================================================
--- ruby_2_3/test/ruby/test_regexp.rb	(revision 55457)
+++ ruby_2_3/test/ruby/test_regexp.rb	(revision 55458)
@@ -389,6 +389,8 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_regexp.rb#L389
     assert_equal(arg_encoding_none, Regexp.new("", nil, "N").options)
 
     assert_raise(RegexpError) { Regexp.new(")(") }
+    assert_raise(RegexpError) { Regexp.new('[\\40000000000') }
+    assert_raise(RegexpError) { Regexp.new('[\\600000000000.') }
   end
 
   def test_unescape
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 55457)
+++ ruby_2_3/version.h	(revision 55458)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.2"
-#define RUBY_RELEASE_DATE "2016-06-19"
-#define RUBY_PATCHLEVEL 133
+#define RUBY_RELEASE_DATE "2016-06-20"
+#define RUBY_PATCHLEVEL 134
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 19
+#define RUBY_RELEASE_DAY 20
 
 #include "ruby/version.h"
 
Index: ruby_2_3/re.c
===================================================================
--- ruby_2_3/re.c	(revision 55457)
+++ ruby_2_3/re.c	(revision 55458)
@@ -2306,8 +2306,8 @@ unescape_nonascii(const char *p, const c https://github.com/ruby/ruby/blob/trunk/ruby_2_3/re.c#L2306
               case '1': case '2': case '3':
               case '4': case '5': case '6': case '7': /* \O, \OO, \OOO or backref */
                 {
-                    size_t octlen;
-                    if (ruby_scan_oct(p-1, end-(p-1), &octlen) <= 0177) {
+                    size_t len = end-(p-1), octlen;
+                    if (ruby_scan_oct(p-1, len < 3 ? len : 3, &octlen) <= 0177) {
                         /* backref or 7bit octal.
                            no need to unescape anyway.
                            re-escaping may break backref */
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 55457)
+++ ruby_2_3/ChangeLog	(revision 55458)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Mon Jun 20 02:25:44 2016  NARUSE, Yui  <naruse@r...>
+
+	* re.c (unescape_nonascii): scan hex up to only 3 characters.
+	  [Bug #12420] [Bug #12423]
+
+Mon Jun 20 02:25:44 2016  NARUSE, Yui  <naruse@r...>
+
+	* regparse.c (fetch_token_in_cc): raise error if given octal escaped
+	  character is too big. [Bug #12420] [Bug #12423]
+
 Sun Jun 19 04:29:13 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/missing.h (isfinite): move from numeric.c.

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r55163,55165


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

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