MCPcopy Create free account
hub / github.com/ElementsProject/elements / FUZZ_TARGET_INIT

Function FUZZ_TARGET_INIT

src/test/fuzz/eval_script.cpp:17–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17FUZZ_TARGET_INIT(eval_script, initialize_eval_script)
18{
19 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
20 const unsigned int flags = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
21 const std::vector<uint8_t> script_bytes = [&] {
22 if (fuzzed_data_provider.remaining_bytes() != 0) {
23 return fuzzed_data_provider.ConsumeRemainingBytes<uint8_t>();
24 } else {
25 // Avoid UBSan warning:
26 // test/fuzz/FuzzedDataProvider.h:212:17: runtime error: null pointer passed as argument 1, which is declared to never be null
27 // /usr/include/string.h:43:28: note: nonnull attribute specified here
28 return std::vector<uint8_t>();
29 }
30 }();
31 const CScript script(script_bytes.begin(), script_bytes.end());
32 for (const auto sig_version : {SigVersion::BASE, SigVersion::WITNESS_V0}) {
33 std::vector<std::vector<unsigned char>> stack;
34 (void)EvalScript(stack, script, flags, BaseSignatureChecker(), sig_version, nullptr);
35 }
36}

Callers

nothing calls this directly

Calls 7

EvalScriptFunction · 0.85
remaining_bytesMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected