MCPcopy Create free account
hub / github.com/ElementsProject/elements / ConsumeFixedLengthByteVector

Function ConsumeFixedLengthByteVector

src/test/fuzz/util.h:261–269  ·  view source on GitHub ↗

* Returns a byte vector of specified size regardless of the number of remaining bytes available * from the fuzzer. Pads with zero value bytes if needed to achieve the specified size. */

Source from the content-addressed store, hash-verified

259 * from the fuzzer. Pads with zero value bytes if needed to achieve the specified size.
260 */
261[[nodiscard]] inline std::vector<uint8_t> ConsumeFixedLengthByteVector(FuzzedDataProvider& fuzzed_data_provider, const size_t length) noexcept
262{
263 std::vector<uint8_t> result(length);
264 const std::vector<uint8_t> random_bytes = fuzzed_data_provider.ConsumeBytes<uint8_t>(length);
265 if (!random_bytes.empty()) {
266 std::memcpy(result.data(), random_bytes.data(), random_bytes.size());
267 }
268 return result;
269}
270
271CNetAddr ConsumeNetAddr(FuzzedDataProvider& fuzzed_data_provider) noexcept;
272

Callers 9

FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
FUZZ_TARGETFunction · 0.85
GetSockOptMethod · 0.85
FUZZ_TARGETFunction · 0.85

Calls 3

emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected