зеркало из https://github.com/github/ruby.git
[ruby/prism] fix: Handle zero-length block parameters in invalid Ruby
Found by fuzzing. https://github.com/ruby/prism/commit/4cd6c8cf98
This commit is contained in:
Родитель
33b92c2d6b
Коммит
e020eb26f0
|
@ -5610,7 +5610,7 @@ pm_parser_parameter_name_check(pm_parser_t *parser, const pm_token_t *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to ignore any parameter name that starts with an underscore.
|
// We want to ignore any parameter name that starts with an underscore.
|
||||||
if ((*name->start == '_')) return;
|
if ((name->start < name->end) && (*name->start == '_')) return;
|
||||||
|
|
||||||
// Otherwise we'll fetch the constant id for the parameter name and check
|
// Otherwise we'll fetch the constant id for the parameter name and check
|
||||||
// whether it's already in the current scope.
|
// whether it's already in the current scope.
|
||||||
|
|
|
@ -57,5 +57,7 @@ module Prism
|
||||||
a
|
a
|
||||||
/{/, ''\\
|
/{/, ''\\
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
|
snippet "parameter name that is zero length", "a { |b;"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче