diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2020-04-22 13:57:28 +0000 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2020-04-26 20:23:56 +0000 |
commit | 1532259fcae8712777e1cedefc91224ee60a6aaa (patch) | |
tree | 72577cf74c69e0479bc655c4794e6420baf70ecf /src/test/fuzz | |
parent | 90b635e84e432e5a3682864f15274dba6acfbded (diff) |
tests: Add fuzzing coverage for FormatHDKeypath(...) and WriteHDKeypath(...)
Diffstat (limited to 'src/test/fuzz')
-rw-r--r-- | src/test/fuzz/parse_hd_keypath.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/fuzz/parse_hd_keypath.cpp b/src/test/fuzz/parse_hd_keypath.cpp index 9a23f4b2d4..f668ca8c48 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 <test/fuzz/FuzzedDataProvider.h> #include <test/fuzz/fuzz.h> +#include <test/fuzz/util.h> #include <util/bip32.h> +#include <cstdint> +#include <vector> + void test_one_input(const std::vector<uint8_t>& buffer) { const std::string keypath_str(buffer.begin(), buffer.end()); std::vector<uint32_t> keypath; (void)ParseHDKeypath(keypath_str, keypath); + + FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); + const std::vector<uint32_t> random_keypath = ConsumeRandomLengthIntegralVector<uint32_t>(fuzzed_data_provider); + (void)FormatHDKeypath(random_keypath); + (void)WriteHDKeypath(random_keypath); } |