aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2019-10-01 10:26:20 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2019-10-23 11:10:10 +0000
commitb5ffa9f3dbff7dd008d4d00a88590d411ef991f2 (patch)
treec68bd50f418c3bbda107f17f1e13a41410638ddf /src/test/fuzz
parentfdef8bbf2f824a87f70b755155e9e1a8cd19fdcb (diff)
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 0000000000..c4c25854fd
--- /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);
+ }
+}