mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Merge bitcoin/bitcoin#24441: fuzz: Limit script_format to 100kB
bbbbeaf9c8
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: ACKbbbbeaf9c8
Tree-SHA512: b6cf7248753909ef2f21d8824f187e7c05732dd3b99619c0067f862f3c2b0f9a87779d4ddbbd3a7a4bae5c794280e2f0a223bf835d6bc6ccaba01817d69479a2
This commit is contained in:
commit
4fae737f4b
@ -3,7 +3,9 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
|
#include <consensus/consensus.h>
|
||||||
#include <core_io.h>
|
#include <core_io.h>
|
||||||
|
#include <policy/policy.h>
|
||||||
#include <script/script.h>
|
#include <script/script.h>
|
||||||
#include <test/fuzz/FuzzedDataProvider.h>
|
#include <test/fuzz/FuzzedDataProvider.h>
|
||||||
#include <test/fuzz/fuzz.h>
|
#include <test/fuzz/fuzz.h>
|
||||||
@ -19,6 +21,9 @@ FUZZ_TARGET_INIT(script_format, initialize_script_format)
|
|||||||
{
|
{
|
||||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||||
const CScript script{ConsumeScript(fuzzed_data_provider)};
|
const CScript script{ConsumeScript(fuzzed_data_provider)};
|
||||||
|
if (script.size() > MAX_STANDARD_TX_WEIGHT / WITNESS_SCALE_FACTOR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
(void)FormatScript(script);
|
(void)FormatScript(script);
|
||||||
(void)ScriptToAsmStr(script, /*fAttemptSighashDecode=*/fuzzed_data_provider.ConsumeBool());
|
(void)ScriptToAsmStr(script, /*fAttemptSighashDecode=*/fuzzed_data_provider.ConsumeBool());
|
||||||
|
Loading…
Reference in New Issue
Block a user