minor missed check

Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
This commit is contained in:
Pratik Mankawde
2026-07-27 15:55:20 +01:00
parent b0c9ef48d1
commit b292d11797

View File

@@ -52,6 +52,18 @@ IOUAmount::normalize()
}
std::tie(mantissa_, exponent_) =
Number::normalizeToRange<kMinMantissa, kMaxMantissa>(mantissa_, exponent_);
// normalizeToRange only enforces Number's much wider exponent bounds.
// Re-apply IOUAmount's narrower range here, matching the check
// IOUAmount(Number const&) applies on its own construction path.
if (exponent_ > kMaxExponent)
{
Throw<std::overflow_error>("value overflow");
}
if (exponent_ < kMinExponent)
{
*this = beast::kZero;
}
}
IOUAmount::IOUAmount(Number const& other) : IOUAmount(fromNumber(other))