mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 11:11:15 +02:00
fuzz: Avoid OOM in transaction fuzz target
Also fix bug where the json object is reused between two calls.
This commit is contained in:
@ -101,7 +101,14 @@ FUZZ_TARGET_INIT(transaction, initialize_transaction)
|
|||||||
(void)AreInputsStandard(tx, coins_view_cache);
|
(void)AreInputsStandard(tx, coins_view_cache);
|
||||||
(void)IsWitnessStandard(tx, coins_view_cache);
|
(void)IsWitnessStandard(tx, coins_view_cache);
|
||||||
|
|
||||||
UniValue u(UniValue::VOBJ);
|
if (tx.GetTotalSize() < 250'000) { // Avoid high memory usage (with msan) due to json encoding
|
||||||
TxToUniv(tx, /*block_hash=*/uint256::ZERO, /*entry=*/u);
|
{
|
||||||
TxToUniv(tx, /*block_hash=*/uint256::ONE, /*entry=*/u);
|
UniValue u{UniValue::VOBJ};
|
||||||
|
TxToUniv(tx, /*block_hash=*/uint256::ZERO, /*entry=*/u);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
UniValue u{UniValue::VOBJ};
|
||||||
|
TxToUniv(tx, /*block_hash=*/uint256::ONE, /*entry=*/u);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user