Merge #492: check amount against MAX_MONEY with unsigned comparison

36a40e8 check amount against MAX_MONEY with unsigned comparison (Dmitry Petukhov)

Pull request description:

  Because explicit conversion of arbitrarily large unsigned values
  to signed values of the same bit width is implementation defined
  until c++20, better check against MAX_MONEY with unsigned comparison.

Tree-SHA512: c4c40a7126b66e7d1c18750a7151619ab76d48098139a800cbf2123dc5f52091c07508c75846415d05ac67d1d21da71bc30d726e120bf35480a48d85df3e7fe5
This commit is contained in:
Gregory Sanders 2019-02-12 13:08:50 -05:00
commit 0da3b15df9
No known key found for this signature in database
GPG key ID: F3F68E2D86A48FDB

View file

@ -95,7 +95,7 @@ bool UnblindConfidentialPair(const CKey &key, const CConfidentialValue& confValu
}
// Value sidechannel must be a transaction-valid amount (should be belt-and-suspenders check)
if (!MoneyRange((CAmount)amount)) {
if (amount > (uint64_t)MAX_MONEY || !MoneyRange((CAmount)amount)) {
return false;
}