diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-12 16:00:14 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-12 16:00:14 +0000 |
commit | 54eb4c1930f81998efe64661e1a6d82df915e9ba (patch) | |
tree | b614dd8d71f7f250d7f642b34a605200b6147a37 | |
parent | 1cc6f36317558a48ccf05ff5758af0c4cd455b79 (diff) |
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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | parse.y | 8 | ||||
-rw-r--r-- | test/ruby/test_syntax.rb | 8 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 23 insertions, 5 deletions
@@ -1,3 +1,13 @@ +Mon Apr 13 00:49:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@ruby-lang.org> + + * 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@80x24.org> * ext/io/wait/wait.c (io_nread): wrap return value with INT2FIX @@ -2100,8 +2100,8 @@ arg : lhs '=' arg 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 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, $$); } /*% diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 86c1090c30..0274a11e83 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -557,6 +557,14 @@ eom 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 @@ -1,6 +1,6 @@ #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 |