Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect against passing i128::MIN to abs() which causes overflow #2241

Merged
merged 8 commits into from
Sep 25, 2024
2 changes: 1 addition & 1 deletion crates/fuel-gas-price-algorithm/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl AlgorithmUpdaterV1 {
.saturating_mul(upcast_percent)
.saturating_div(100)
.into();
let clamped_change = pd_change.abs().min(max_change);
let clamped_change = pd_change.saturating_abs().min(max_change);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Nice find.

pd_change.signum().saturating_mul(clamped_change)
}

Expand Down
Loading