aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz
diff options
context:
space:
mode:
authorpracticalswift <[email protected]>2019-10-01 10:26:20 +0000
committerpracticalswift <[email protected]>2019-10-23 11:10:10 +0000
commitb5ffa9f3dbff7dd008d4d00a88590d411ef991f2 (patch)
treec68bd50f418c3bbda107f17f1e13a41410638ddf /src/test/fuzz
parenttests: Allow for using non-default fuzzing initialization (diff)
downloaddiscoin-b5ffa9f3dbff7dd008d4d00a88590d411ef991f2.tar.xz
discoin-b5ffa9f3dbff7dd008d4d00a88590d411ef991f2.zip
tests: Add Parse(...) (descriptor) fuzzing harness
Diffstat (limited to 'src/test/fuzz')
-rw-r--r--src/test/fuzz/descriptor_parse.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/fuzz/descriptor_parse.cpp b/src/test/fuzz/descriptor_parse.cpp
new file mode 100644
index 000000000..c4c25854f
--- /dev/null
+++ b/src/test/fuzz/descriptor_parse.cpp
@@ -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);
+ }
+}