sanitize Source.loc argument

This commit is contained in:
TopchetoEU 2025-01-12 03:10:44 +02:00
parent 24d0cb73b6
commit 3623842827
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -12,6 +12,8 @@ public class Source {
private int[] lineStarts;
public Location loc(int offset) {
if (offset < 0) offset = 0;
if (offset > src.length()) offset = src.length();
return new SourceLocation(filename, lineStarts, offset);
}
public boolean is(int i, char c) {