Skip to content

Commit d50cf99

Browse files
committed
Fix out of bounds access when parsing end_pos
1 parent 93fa00c commit d50cf99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/odin/parser/parser.odin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ end_pos :: proc(tok: tokenizer.Token) -> tokenizer.Pos {
9999
pos := tok.pos
100100
pos.offset += len(tok.text)
101101

102-
if tok.kind == .Comment || tok.kind == .String {
102+
if (tok.kind == .Comment && len(tok.text) >= 2) || (tok.kind == .String && len(tok.text) >= 1) {
103103
if tok.text[:2] == "/*" || tok.text[:1] == "`" {
104104
for i := 0; i < len(tok.text); i += 1 {
105105
c := tok.text[i]

0 commit comments

Comments
 (0)