mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05: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:
parent
d1ae96755a
commit
fa31c4daac
1 changed files with 10 additions and 3 deletions
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue