mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
util: Avoid invalid integer negation in ValueFromAmount: make ValueFromAmount(const CAmount& n) well-defined also when n is std::numeric_limits<CAmount>::min()
This commit is contained in:
@@ -100,16 +100,7 @@ FUZZ_TARGET_INIT(transaction, initialize_transaction)
|
||||
(void)IsWitnessStandard(tx, coins_view_cache);
|
||||
|
||||
UniValue u(UniValue::VOBJ);
|
||||
// ValueFromAmount(i) not defined when i == std::numeric_limits<int64_t>::min()
|
||||
bool skip_tx_to_univ = false;
|
||||
for (const CTxOut& txout : tx.vout) {
|
||||
if (txout.nValue == std::numeric_limits<int64_t>::min()) {
|
||||
skip_tx_to_univ = true;
|
||||
}
|
||||
}
|
||||
if (!skip_tx_to_univ) {
|
||||
TxToUniv(tx, /* hashBlock */ {}, u);
|
||||
static const uint256 u256_max(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
||||
TxToUniv(tx, u256_max, u);
|
||||
}
|
||||
TxToUniv(tx, /* hashBlock */ {}, u);
|
||||
static const uint256 u256_max(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
||||
TxToUniv(tx, u256_max, u);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user