Skip to content

Commit 4fae737

Browse files
committed
Merge bitcoin/bitcoin#24441: fuzz: Limit script_format to 100kB
bbbbeaf fuzz: Limit script_format to 100kB (MarcoFalke) Pull request description: The target is still one of the slowest ones, but doesn't seem incredibly important. Especially for sizes larger than the standard tx size. Fix that by limiting the script size. ACKs for top commit: fanquake: ACK bbbbeaf Tree-SHA512: b6cf7248753909ef2f21d8824f187e7c05732dd3b99619c0067f862f3c2b0f9a87779d4ddbbd3a7a4bae5c794280e2f0a223bf835d6bc6ccaba01817d69479a2
2 parents 619f8a2 + bbbbeaf commit 4fae737

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/test/fuzz/script_format.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <chainparams.h>
6+
#include <consensus/consensus.h>
67
#include <core_io.h>
8+
#include <policy/policy.h>
79
#include <script/script.h>
810
#include <test/fuzz/FuzzedDataProvider.h>
911
#include <test/fuzz/fuzz.h>
@@ -19,6 +21,9 @@ FUZZ_TARGET_INIT(script_format, initialize_script_format)
1921
{
2022
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
2123
const CScript script{ConsumeScript(fuzzed_data_provider)};
24+
if (script.size() > MAX_STANDARD_TX_WEIGHT / WITNESS_SCALE_FACTOR) {
25+
return;
26+
}
2227

2328
(void)FormatScript(script);
2429
(void)ScriptToAsmStr(script, /*fAttemptSighashDecode=*/fuzzed_data_provider.ConsumeBool());

0 commit comments

Comments
 (0)