summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--prism/prism.c2
-rw-r--r--test/prism/fuzzer_test.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/prism/prism.c b/prism/prism.c
index 4bac4d8c76..312036770b 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -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.
- 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
// whether it's already in the current scope.
diff --git a/test/prism/fuzzer_test.rb b/test/prism/fuzzer_test.rb
index 04e45518b1..0aabd56242 100644
--- a/test/prism/fuzzer_test.rb
+++ b/test/prism/fuzzer_test.rb
@@ -57,5 +57,7 @@ module Prism
a
/{/, ''\\
RUBY
+
+ snippet "parameter name that is zero length", "a { |b;"
end
end