mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge d53828cb79 into merged_master (Bitcoin PR #17235)
This commit is contained in:
commit
70b8b429e4
2 changed files with 11 additions and 12 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -44,13 +40,9 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Disabled under WIN32 due to clash with Cygwin's WinMain.
|
||||
#ifndef WIN32
|
||||
// Declare main(...) "weak" to allow for libFuzzer linking. libFuzzer provides
|
||||
// the main(...) function.
|
||||
__attribute__((weak))
|
||||
#endif
|
||||
int main(int argc, char **argv)
|
||||
__attribute__((weak)) int main(int argc, char** argv)
|
||||
{
|
||||
initialize();
|
||||
#ifdef __AFL_INIT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue