Skip to content

Commit

Permalink
Merge pull request #906 from schungx/master
Browse files Browse the repository at this point in the history
Fix subtraction underflow bug
  • Loading branch information
schungx authored Aug 2, 2024
2 parents 614f8f0 + ebfa1b8 commit 5028afb
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 5028afb

Please sign in to comment.