aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2020-11-12 15:07:53 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2020-12-27 19:27:41 +0000
commit4ddbcd0d9abe40cd387e63d8c4817e0fe36004dc (patch)
tree93f343615607e090adbc68600bab7d774bb6fbe4 /src/test
parent546a0764f3b701ee07f5a8d168e2a58fed6b46d5 (diff)
fuzz: Add coverage for CDataStream consumer
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fuzz/data_stream.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/fuzz/data_stream.cpp b/src/test/fuzz/data_stream.cpp
new file mode 100644
index 0000000000..28fc528ceb
--- /dev/null
+++ b/src/test/fuzz/data_stream.cpp
@@ -0,0 +1,25 @@
+// Copyright (c) 2020 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 <addrman.h>
+#include <net.h>
+#include <test/fuzz/FuzzedDataProvider.h>
+#include <test/fuzz/fuzz.h>
+#include <test/fuzz/util.h>
+
+#include <cstdint>
+#include <vector>
+
+void initialize_data_stream_addr_man()
+{
+ InitializeFuzzingContext();
+}
+
+FUZZ_TARGET_INIT(data_stream_addr_man, initialize_data_stream_addr_man)
+{
+ FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
+ CDataStream data_stream = ConsumeDataStream(fuzzed_data_provider);
+ CAddrMan addr_man;
+ CAddrDB::Read(addr_man, data_stream);
+}