diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/deserialize.cpp | 7 | ||||
-rw-r--r-- | src/test/fuzz/fuzz.cpp | 13 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp index 3a6876ad39..bcd8691359 100644 --- a/src/test/fuzz/deserialize.cpp +++ b/src/test/fuzz/deserialize.cpp @@ -12,6 +12,7 @@ #include <net.h> #include <primitives/block.h> #include <protocol.h> +#include <pubkey.h> #include <streams.h> #include <undo.h> #include <version.h> @@ -23,6 +24,12 @@ #include <test/fuzz/fuzz.h> +void initialize() +{ + // Fuzzers using pubkey must hold an ECCVerifyHandle. + static const auto verify_handle = MakeUnique<ECCVerifyHandle>(); +} + void test_one_input(const std::vector<uint8_t>& buffer) { CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); diff --git a/src/test/fuzz/fuzz.cpp b/src/test/fuzz/fuzz.cpp index a8a108cd18..44256ce867 100644 --- a/src/test/fuzz/fuzz.cpp +++ b/src/test/fuzz/fuzz.cpp @@ -4,11 +4,9 @@ #include <test/fuzz/fuzz.h> +#include <cstdint> #include <unistd.h> - -#include <pubkey.h> -#include <util/memory.h> - +#include <vector> static bool read_stdin(std::vector<uint8_t>& data) { @@ -23,10 +21,8 @@ static bool read_stdin(std::vector<uint8_t>& data) } // Default initialization: Override using a non-weak initialize(). -__attribute__((weak)) -void initialize() +__attribute__((weak)) void initialize() { - const static auto verify_handle = MakeUnique<ECCVerifyHandle>(); } // This function is used by libFuzzer @@ -50,7 +46,8 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) // the main(...) function. __attribute__((weak)) #endif -int main(int argc, char **argv) +int +main(int argc, char** argv) { initialize(); #ifdef __AFL_INIT |