mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
Merge bitcoin/bitcoin#27921: fuzz: Avoid OOM in transaction fuzz target
fa31c4daac
fuzz: Avoid OOM in transaction fuzz target (MarcoFalke) Pull request description: To test: `FUZZ=transaction /usr/bin/time -f '%Us %MkB' ./src/test/fuzz/fuzz ../btc_qa_assets/fuzz_seed_corpus/transaction/9dc22b51df0af05ee5a595beefb0ce291feb6b99` Before: `0.72s 249636kB` After: `0.30s 92128kB` ACKs for top commit: dergoegge: utACKfa31c4daac
Tree-SHA512: 958fc54e7af31af7db3e3e1fb37553ae24de251c7fdeea3d68ec168f03db48de6aa54a96bf971f9cc804e94ff8a02fda9c56d7e85869d62962f6f020568e3a7b
This commit is contained in:
commit
f1b4975461
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)IsWitnessStandard(tx, coins_view_cache);
|
||||
|
||||
UniValue u(UniValue::VOBJ);
|
||||
TxToUniv(tx, /*block_hash=*/uint256::ZERO, /*entry=*/u);
|
||||
TxToUniv(tx, /*block_hash=*/uint256::ONE, /*entry=*/u);
|
||||
if (tx.GetTotalSize() < 250'000) { // Avoid high memory usage (with msan) due to json encoding
|
||||
{
|
||||
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