Avoid integer overflow in analysis.getPositionContext (#998)

This commit is contained in:
nullptrdevs 2023-02-13 17:09:36 -08:00 committed by GitHub
parent b28d3aadd7
commit 290ed6e7e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1577,7 +1577,7 @@ pub fn getPositionContext(
};
}
const q = std.mem.lastIndexOf(u8, held_line, "\"") orelse return .other;
if (held_line[q - 1] == '@') {
if (held_line[q -| 1] == '@') {
tok.tag = .identifier;
} else {
tok.tag = .string_literal;