Skip to content

Commit

Permalink
fix an overflowing division in the fuzz testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Mar 31, 2021
1 parent 0a499cd commit d1aff18
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fuzz/fuzz_targets/fuzz_arithmetic.rs
Expand Up @@ -43,7 +43,12 @@ fn term(i: &str) -> IResult<&str, i64> {
if op == '*' {
acc.saturating_mul(val)
} else {
acc / val
match acc.checked_div(val) {
Some(v) => v,
// we get a division with overflow because we can get acc = i64::MIN and val = -1
// the division by zero is already checked earlier by verify
None => i64::MAX,
}
}
},
)(i)
Expand Down

0 comments on commit d1aff18

Please sign in to comment.