Skip to content

Commit 5c08568

Browse files
authored
fix: Use saturating_sub in try_map_token to prevent overflow (#21)
1 parent 9cb9a8a commit 5c08568

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/name_resolver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl<'a, T: AsRef<str>> NameResolver<'a, T> {
3434
.lookup_token(source_position.line, source_position.column)?;
3535

3636
let is_exactish_match = token.get_dst_line() == source_position.line
37-
&& token.get_dst_col() >= source_position.column - 1;
37+
&& token.get_dst_col() >= source_position.column.saturating_sub(1);
3838

3939
if is_exactish_match {
4040
token.get_name()

0 commit comments

Comments
 (0)