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

ruby-changes:38196

From: nagachika <ko1@a...>
Date: Mon, 13 Apr 2015 01:01:20 +0900 (JST)
Subject: [ruby-changes:38196] nagachika:r50277 (ruby_2_2): merge revision(s) 49964, 50265: [Backport #11047] [Backport #10957]

nagachika	2015-04-13 01:00:14 +0900 (Mon, 13 Apr 2015)

  New Revision: 50277

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

  Log:
    merge revision(s) 49964,50265: [Backport #11047] [Backport #10957]
    
    * parse.y (primary): empty parentheses at cmdarg can be null.
      [ruby-core:68477] [Bug #10957]
    
    * parse.y (arg): fix segfault by null caused by syntax error.
      [ruby-core:68851] [Bug #10957]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/parse.y
    branches/ruby_2_2/test/ruby/test_syntax.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 50276)
+++ ruby_2_2/ChangeLog	(revision 50277)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Mon Apr 13 00:49:56 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (arg): fix segfault by null caused by syntax error.
+	  [ruby-core:68851] [Bug #10957]
+
+Mon Apr 13 00:49:56 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (primary): empty parentheses at cmdarg can be null.
+	  [ruby-core:68477] [Bug #10957]
+
 Mon Apr 13 00:44:12 2015  Eric Wong  <e@8...>
 
 	* ext/io/wait/wait.c (io_nread): wrap return value with INT2FIX
Index: ruby_2_2/parse.y
===================================================================
--- ruby_2_2/parse.y	(revision 50276)
+++ ruby_2_2/parse.y	(revision 50277)
@@ -2100,8 +2100,8 @@ arg		: lhs '=' arg https://github.com/ruby/ruby/blob/trunk/ruby_2_2/parse.y#L2100
 			value_expr($1);
 			value_expr($3);
 			$$ = NEW_DOT2($1, $3);
-			if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
-			    nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
+			if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
+			    $3 && nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
 			    deferred_nodes = list_append(deferred_nodes, $$);
 			}
 		    /*%
@@ -2114,8 +2114,8 @@ arg		: lhs '=' arg https://github.com/ruby/ruby/blob/trunk/ruby_2_2/parse.y#L2114
 			value_expr($1);
 			value_expr($3);
 			$$ = NEW_DOT3($1, $3);
-			if (nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
-			    nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
+			if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
+			    $3 && nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
 			    deferred_nodes = list_append(deferred_nodes, $$);
 			}
 		    /*%
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 50276)
+++ ruby_2_2/version.h	(revision 50277)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.2"
 #define RUBY_RELEASE_DATE "2015-04-13"
-#define RUBY_PATCHLEVEL 92
+#define RUBY_PATCHLEVEL 93
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 4
Index: ruby_2_2/test/ruby/test_syntax.rb
===================================================================
--- ruby_2_2/test/ruby/test_syntax.rb	(revision 50276)
+++ ruby_2_2/test/ruby/test_syntax.rb	(revision 50277)
@@ -557,6 +557,14 @@ eom https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_syntax.rb#L557
     assert_syntax_error(src, /formal argument/, bug10545)
   end
 
+  def test_null_range_cmdarg
+    bug10957 = '[ruby-core:68477] [Bug #10957]'
+    assert_ruby_status(['-c', '-e', 'p ()..0'], "", bug10957)
+    assert_ruby_status(['-c', '-e', 'p ()...0'], "", bug10957)
+    assert_syntax_error('0..%w.', /unterminated string/, bug10957)
+    assert_syntax_error('0...%w.', /unterminated string/, bug10957)
+  end
+
   private
 
   def not_label(x) @result = x; @not_label ||= nil end

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49964,50265


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

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