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

&. is not allowed inside LHS of massign

https://hackerone.com/reports/605262
This commit is contained in:
Nobuyoshi Nakada 2019-06-11 02:09:00 +09:00
parent 42ac8890ef
commit 140b8117bd
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 11 additions and 0 deletions

View file

@ -1787,6 +1787,9 @@ mlhs_node : user_variable
}
| primary_value call_op tIDENTIFIER
{
if ($2 == tANDDOT) {
yyerror1(&@2, "&. inside LHS of multiple assignment");
}
/*%%%*/
$$ = attrset(p, $1, $2, $3, &@$);
/*% %*/
@ -1801,6 +1804,9 @@ mlhs_node : user_variable
}
| primary_value call_op tCONSTANT
{
if ($2 == tANDDOT) {
yyerror1(&@2, "&. inside LHS of multiple assignment");
}
/*%%%*/
$$ = attrset(p, $1, $2, $3, &@$);
/*% %*/

View file

@ -976,6 +976,11 @@ eom
assert_valid_syntax("a\n.:foo")
end
def test_safe_call_in_massign_lhs
assert_syntax_error("*a&.x=0", /LHS/)
assert_syntax_error("a&.x,=0", /LHS/)
end
def test_no_warning_logop_literal
assert_warning("") do
eval("true||raise;nil")