Skip to content

Commit 9cae3d5

Browse files
tests: Add fuzzer initialization (hold ECCVerifyHandle)
1 parent be50469 commit 9cae3d5

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/test/fuzz/eval_script.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5+
#include <pubkey.h>
56
#include <script/interpreter.h>
6-
#include <test/fuzz/FuzzedDataProvider.h>
77
#include <test/fuzz/fuzz.h>
8+
#include <test/fuzz/FuzzedDataProvider.h>
9+
#include <util/memory.h>
810

911
#include <limits>
1012

13+
void initialize()
14+
{
15+
static const auto verify_handle = MakeUnique<ECCVerifyHandle>();
16+
}
17+
1118
void test_one_input(const std::vector<uint8_t>& buffer)
1219
{
1320
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());

src/test/fuzz/script_flags.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5+
#include <pubkey.h>
56
#include <script/interpreter.h>
67
#include <streams.h>
8+
#include <util/memory.h>
79
#include <version.h>
810

911
#include <test/fuzz/fuzz.h>
1012

1113
/** Flags that are not forbidden by an assert */
1214
static bool IsValidFlagCombination(unsigned flags);
1315

16+
void initialize()
17+
{
18+
static const auto verify_handle = MakeUnique<ECCVerifyHandle>();
19+
}
20+
1421
void test_one_input(const std::vector<uint8_t>& buffer)
1522
{
1623
CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION);

0 commit comments

Comments
 (0)