Skip to content

Commit

Permalink
Fix subtraction underflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Aug 1, 2024
1 parent b7abf44 commit ebfa1b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Bug fixes
---------

* (Fuzzing) An integer-overflow bug from an inclusive range in the bits iterator is fixed.
* (Fuzzing) An integer-underflow bug from an inclusive range is fixed.

Enhancements
------------
Expand Down
2 changes: 2 additions & 0 deletions src/eval/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ impl<'a> Target<'a> {
let ve = if *exclusive {
let end = if *end > n { n } else { *end };
s.chars().skip(end)
} else if n == 0 {
s.chars().skip(usize::MAX)
} else {
let end = if *end >= n { n - 1 } else { *end };
s.chars().skip(end + 1)
Expand Down

0 comments on commit ebfa1b8

Please sign in to comment.