Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ bool tree_sitter_nu_external_scanner_scan(
TSLexer *lexer,
const bool *valid_symbols
) {
if (valid_symbols[ERROR_SENTINEL]) {
// During error recovery tree-sitter marks every real external token as
// valid; ERROR_SENTINEL is not a declared external token, so indexing
// valid_symbols[ERROR_SENTINEL] reads past the end of the array. Detect
// error recovery by checking only the valid, in-range token slots.
if (valid_symbols[RAW_STRING_BEGIN] &&
valid_symbols[RAW_STRING_CONTENT] &&
valid_symbols[RAW_STRING_END]) {
return false;
}

Expand Down
Loading