From 1532259fcae8712777e1cedefc91224ee60a6aaa Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 22 Apr 2020 13:57:28 +0000 Subject: [PATCH] tests: Add fuzzing coverage for FormatHDKeypath(...) and WriteHDKeypath(...) --- src/test/fuzz/parse_hd_keypath.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/fuzz/parse_hd_keypath.cpp b/src/test/fuzz/parse_hd_keypath.cpp index 9a23f4b2d43..f668ca8c48b 100644 --- a/src/test/fuzz/parse_hd_keypath.cpp +++ b/src/test/fuzz/parse_hd_keypath.cpp @@ -2,12 +2,22 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include #include +#include #include +#include +#include + void test_one_input(const std::vector& buffer) { const std::string keypath_str(buffer.begin(), buffer.end()); std::vector keypath; (void)ParseHDKeypath(keypath_str, keypath); + + FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); + const std::vector random_keypath = ConsumeRandomLengthIntegralVector(fuzzed_data_provider); + (void)FormatHDKeypath(random_keypath); + (void)WriteHDKeypath(random_keypath); }