Skip to content

fix off-by-one range clamp in getTokensSet - #239

Open
zayeem06 wants to merge 1 commit into
antlr:masterfrom
zayeem06:token-range-off-by-one
Open

fix off-by-one range clamp in getTokensSet#239
zayeem06 wants to merge 1 commit into
antlr:masterfrom
zayeem06:token-range-off-by-one

Conversation

@zayeem06

Copy link
Copy Markdown

getTokensSet clamps the stop index to the token count rather than count - 1, so a range whose end lands on the token count runs the loop one entry past the last token and get() returns NULL, which the type filter dereferences. The sibling toStringSS in the same file already clamps to size - 1, so I matched it there. While in that loop I also corrected a misplaced parenthesis in the membership test that made getTokensType/getTokensList compare against a boolean instead of passing the token type into isMember, worth a quick look since it changes what those two helpers return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant