File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ FUZZ_TARGETS = \
45
45
test/fuzz/key_origin_info_deserialize \
46
46
test/fuzz/locale \
47
47
test/fuzz/merkle_block_deserialize \
48
+ test/fuzz/merkleblock \
48
49
test/fuzz/messageheader_deserialize \
49
50
test/fuzz/multiplication_overflow \
50
51
test/fuzz/net_permissions \
@@ -541,6 +542,12 @@ test_fuzz_merkle_block_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
541
542
test_fuzz_merkle_block_deserialize_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
542
543
test_fuzz_merkle_block_deserialize_SOURCES = $(FUZZ_SUITE) test/fuzz/deserialize.cpp
543
544
545
+ test_fuzz_merkleblock_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
546
+ test_fuzz_merkleblock_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
547
+ test_fuzz_merkleblock_LDADD = $(FUZZ_SUITE_LD_COMMON)
548
+ test_fuzz_merkleblock_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
549
+ test_fuzz_merkleblock_SOURCES = $(FUZZ_SUITE) test/fuzz/merkleblock.cpp
550
+
544
551
test_fuzz_messageheader_deserialize_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DMESSAGEHEADER_DESERIALIZE=1
545
552
test_fuzz_messageheader_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
546
553
test_fuzz_messageheader_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2020 The Bitcoin Core developers
2
+ // Distributed under the MIT software license, see the accompanying
3
+ // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
+
5
+ #include < merkleblock.h>
6
+ #include < optional.h>
7
+ #include < test/fuzz/FuzzedDataProvider.h>
8
+ #include < test/fuzz/fuzz.h>
9
+ #include < test/fuzz/util.h>
10
+ #include < uint256.h>
11
+
12
+ #include < cstdint>
13
+ #include < string>
14
+ #include < vector>
15
+
16
+ void test_one_input (const std::vector<uint8_t >& buffer)
17
+ {
18
+ FuzzedDataProvider fuzzed_data_provider (buffer.data (), buffer.size ());
19
+ Optional<CPartialMerkleTree> partial_merkle_tree = ConsumeDeserializable<CPartialMerkleTree>(fuzzed_data_provider);
20
+ if (!partial_merkle_tree) {
21
+ return ;
22
+ }
23
+ (void )partial_merkle_tree->GetNumTransactions ();
24
+ std::vector<uint256> matches;
25
+ std::vector<unsigned int > indices;
26
+ (void )partial_merkle_tree->ExtractMatches (matches, indices);
27
+ }
You can’t perform that action at this time.
0 commit comments