MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ConsumeRandomLengthByteVector

Function ConsumeRandomLengthByteVector

src/test/fuzz/util.h:63–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61
62template<typename B = uint8_t>
63[[nodiscard]] inline std::vector<B> ConsumeRandomLengthByteVector(FuzzedDataProvider& fuzzed_data_provider, const std::optional<size_t>& max_length = std::nullopt) noexcept
64{
65 static_assert(sizeof(B) == 1);
66 const std::string s = max_length ?
67 fuzzed_data_provider.ConsumeRandomLengthString(*max_length) :
68 fuzzed_data_provider.ConsumeRandomLengthString();
69 std::vector<B> ret(s.size());
70 std::copy(s.begin(), s.end(), reinterpret_cast<char*>(ret.data()));
71 return ret;
72}
73
74[[nodiscard]] inline DataStream ConsumeDataStream(FuzzedDataProvider& fuzzed_data_provider, const std::optional<size_t>& max_length = std::nullopt) noexcept
75{

Callers 15

crypter.cppFile · 0.85
FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
utxo_snapshot_fuzzFunction · 0.85
FUZZ_TARGETFunction · 0.85
p2p_handshake.cppFile · 0.85
script_sign.cppFile · 0.85
FUZZ_TARGETFunction · 0.85
script.cppFile · 0.85

Calls 5

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected