mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
tests: Add Parse(...) (descriptor) fuzzing harness
This commit is contained in:
parent
fdef8bbf2f
commit
b5ffa9f3db
2 changed files with 29 additions and 0 deletions
|
@ -16,6 +16,7 @@ FUZZ_TARGETS = \
|
|||
test/fuzz/blockundo_deserialize \
|
||||
test/fuzz/bloomfilter_deserialize \
|
||||
test/fuzz/coins_deserialize \
|
||||
test/fuzz/descriptor_parse \
|
||||
test/fuzz/diskblockindex_deserialize \
|
||||
test/fuzz/eval_script \
|
||||
test/fuzz/inv_deserialize \
|
||||
|
@ -253,6 +254,12 @@ test_fuzz_coins_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
|||
test_fuzz_coins_deserialize_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
test_fuzz_coins_deserialize_LDADD = $(FUZZ_SUITE_LD_COMMON)
|
||||
|
||||
test_fuzz_descriptor_parse_SOURCES = $(FUZZ_SUITE) test/fuzz/descriptor_parse.cpp
|
||||
test_fuzz_descriptor_parse_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
test_fuzz_descriptor_parse_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
test_fuzz_descriptor_parse_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
test_fuzz_descriptor_parse_LDADD = $(FUZZ_SUITE_LD_COMMON)
|
||||
|
||||
test_fuzz_netaddr_deserialize_SOURCES = $(FUZZ_SUITE) test/fuzz/deserialize.cpp
|
||||
test_fuzz_netaddr_deserialize_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DNETADDR_DESERIALIZE=1
|
||||
test_fuzz_netaddr_deserialize_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
|
|
22
src/test/fuzz/descriptor_parse.cpp
Normal file
22
src/test/fuzz/descriptor_parse.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <script/descriptor.h>
|
||||
#include <test/fuzz/fuzz.h>
|
||||
|
||||
void initialize()
|
||||
{
|
||||
SelectParams(CBaseChainParams::REGTEST);
|
||||
}
|
||||
|
||||
void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
{
|
||||
const std::string descriptor(buffer.begin(), buffer.end());
|
||||
FlatSigningProvider signing_provider;
|
||||
std::string error;
|
||||
for (const bool require_checksum : {true, false}) {
|
||||
Parse(descriptor, signing_provider, error, require_checksum);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue