summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/yarp/fuzzer_test.rb1
-rw-r--r--yarp/yarp.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/test/yarp/fuzzer_test.rb b/test/yarp/fuzzer_test.rb
index e2aa9dab61..8da1a2dc76 100644
--- a/test/yarp/fuzzer_test.rb
+++ b/test/yarp/fuzzer_test.rb
@@ -15,4 +15,5 @@ class FuzzerTest < Test::Unit::TestCase
snippet "incomplete global variable", "$"
snippet "incomplete symbol", ":"
snippet "incomplete escaped string", '"\\'
+ snippet "trailing comment", "1\n#\n"
end
diff --git a/yarp/yarp.c b/yarp/yarp.c
index 91c814af9a..ce991003f1 100644
--- a/yarp/yarp.c
+++ b/yarp/yarp.c
@@ -5908,7 +5908,7 @@ parser_lex(yp_parser_t *parser) {
// Here we look for a "." or "&." following a "\n".
const char *following = next_newline(next_content, parser->end - next_content);
- while (following && (following < parser->end)) {
+ while (following && (following + 1 < parser->end)) {
following++;
following += yp_strspn_inline_whitespace(following, parser->end - following);