mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
feefrac test: avoid integer overflow (bugfix)
This commit is contained in:
parent
cfe025ff0e
commit
a2bc330da8
@ -220,9 +220,9 @@ FUZZ_TARGET(feefrac_mul_div)
|
||||
assert(res == res_fee);
|
||||
|
||||
// Compare approximately with CFeeRate.
|
||||
if (mul64 <= std::numeric_limits<int64_t>::max() / 1000 &&
|
||||
mul64 >= std::numeric_limits<int64_t>::min() / 1000 &&
|
||||
quot_abs <= arith_uint256{std::numeric_limits<int64_t>::max() / 1000}) {
|
||||
if (mul64 < std::numeric_limits<int64_t>::max() / 1000 &&
|
||||
mul64 > std::numeric_limits<int64_t>::min() / 1000 &&
|
||||
quot_abs < arith_uint256{std::numeric_limits<int64_t>::max() / 1000}) {
|
||||
CFeeRate feerate(mul64, (uint32_t)div);
|
||||
CAmount feerate_fee{feerate.GetFee(mul32)};
|
||||
auto allowed_gap = static_cast<int64_t>(mul32 / 1000 + 3 + round_down);
|
||||
|
Loading…
Reference in New Issue
Block a user