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 = \
4545 test/fuzz/key_origin_info_deserialize \
4646 test/fuzz/locale \
4747 test/fuzz/merkle_block_deserialize \
48+ test/fuzz/merkleblock \
4849 test/fuzz/messageheader_deserialize \
4950 test/fuzz/multiplication_overflow \
5051 test/fuzz/net_permissions \
@@ -541,6 +542,12 @@ test_fuzz_merkle_block_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
541542test_fuzz_merkle_block_deserialize_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
542543test_fuzz_merkle_block_deserialize_SOURCES = $(FUZZ_SUITE) test/fuzz/deserialize.cpp
543544
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+
544551test_fuzz_messageheader_deserialize_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DMESSAGEHEADER_DESERIALIZE=1
545552test_fuzz_messageheader_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
546553test_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