Skip to content

Commit

Permalink
Source: check for truncated utf-8 codepoint at EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
ehaas committed Apr 12, 2024
1 parent 128d089 commit 88c1b0f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/aro/Source.zig
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ pub fn lineCol(source: Source, loc: Location) LineCol {
i += 1;
continue;
};
const slice = source.buf[i..];
if (len > slice.len) {
break;
}
const cp = std.unicode.utf8Decode(source.buf[i..][0..len]) catch {
i += 1;
continue;
Expand Down

0 comments on commit 88c1b0f

Please sign in to comment.