[ruby/yarp] fix: comment followed by whitespace at end of file
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/b248553dd6
This commit is contained in:
parent
ae7f907559
commit
2d009805e7
@ -16,6 +16,7 @@ class FuzzerTest < Test::Unit::TestCase
|
||||
snippet "incomplete symbol", ":"
|
||||
snippet "incomplete escaped string", '"\\'
|
||||
snippet "trailing comment", "1\n#\n"
|
||||
snippet "comment followed by whitespace at end of file", "1\n#\n "
|
||||
snippet "trailing asterisk", "a *"
|
||||
snippet "incomplete decimal number", "0d"
|
||||
snippet "incomplete binary number", "0b"
|
||||
|
@ -5921,7 +5921,7 @@ parser_lex(yp_parser_t *parser) {
|
||||
|
||||
// If this is not followed by a comment, then we can break out
|
||||
// of this loop.
|
||||
if (*following != '#') break;
|
||||
if (peek_at(parser, following) != '#') break;
|
||||
|
||||
// If there is a comment, then we need to find the end of the
|
||||
// comment and continue searching from there.
|
||||
|
Loading…
x
Reference in New Issue
Block a user