From f5b4fc2aeaedb4aea9798fcaac22041f43fd6792 Mon Sep 17 00:00:00 2001 From: lithdew Date: Fri, 25 Sep 2020 12:59:45 +0900 Subject: [PATCH] offsets: fix integer overflow --- src/offsets.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/offsets.zig b/src/offsets.zig index 051b7c7..51fd6ac 100644 --- a/src/offsets.zig +++ b/src/offsets.zig @@ -81,7 +81,7 @@ pub fn tokenRelativeLocation(tree: *std.zig.ast.Tree, start_index: usize, token: const token_start = token_loc.start; const source = tree.source[start_index..]; var i: usize = 0; - while (i < token_start - start_index) { + while (i + start_index < token_start) { const c = source[i]; if (c == '\n') { loc.line += 1;