1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: null by syntax error

* 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/trunk@50265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-04-12 06:35:02 +00:00
parent e40ab5942b
commit ee725321b6
3 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Sun Apr 12 15:34:59 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (arg): fix segfault by null caused by syntax error.
[ruby-core:68851] [Bug #10957]
Sun Apr 12 15:11:16 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com> Sun Apr 12 15:11:16 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/rubygems/test_case.rb: use explicitly exception class and reverted * lib/rubygems/test_case.rb: use explicitly exception class and reverted

View file

@ -2103,7 +2103,7 @@ arg : lhs '=' arg
value_expr($3); value_expr($3);
$$ = NEW_DOT2($1, $3); $$ = NEW_DOT2($1, $3);
if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) && if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) { $3 && nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
deferred_nodes = list_append(deferred_nodes, $$); deferred_nodes = list_append(deferred_nodes, $$);
} }
/*% /*%
@ -2117,7 +2117,7 @@ arg : lhs '=' arg
value_expr($3); value_expr($3);
$$ = NEW_DOT3($1, $3); $$ = NEW_DOT3($1, $3);
if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) && if ($1 && nd_type($1) == NODE_LIT && FIXNUM_P($1->nd_lit) &&
nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) { $3 && nd_type($3) == NODE_LIT && FIXNUM_P($3->nd_lit)) {
deferred_nodes = list_append(deferred_nodes, $$); deferred_nodes = list_append(deferred_nodes, $$);
} }
/*% /*%

View file

@ -561,6 +561,8 @@ eom
bug10957 = '[ruby-core:68477] [Bug #10957]' bug10957 = '[ruby-core:68477] [Bug #10957]'
assert_ruby_status(['-c', '-e', 'p ()..0'], "", bug10957) assert_ruby_status(['-c', '-e', 'p ()..0'], "", bug10957)
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 end
private private