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

Function FUZZ_TARGET

src/test/fuzz/kitchen_sink.cpp:37–59  ·  view source on GitHub ↗

The fuzzing kitchen sink: Fuzzing harness for functions that need to be fuzzed but a.) don't belong in any existing fuzzing harness file, and b.) are not important enough to warrant their own fuzzing harness file.

Source from the content-addressed store, hash-verified

35// fuzzed but a.) don't belong in any existing fuzzing harness file, and
36// b.) are not important enough to warrant their own fuzzing harness file.
37FUZZ_TARGET(kitchen_sink)
38{
39 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
40
41 const TransactionError transaction_error = fuzzed_data_provider.PickValueInArray(ALL_TRANSACTION_ERROR);
42 (void)JSONRPCTransactionError(transaction_error);
43 (void)RPCErrorFromTransactionError(transaction_error);
44 (void)TransactionErrorString(transaction_error);
45
46 (void)StringForFeeEstimateHorizon(fuzzed_data_provider.PickValueInArray(ALL_FEE_ESTIMATE_HORIZONS));
47
48 const OutputType output_type = fuzzed_data_provider.PickValueInArray(OUTPUT_TYPES);
49 const std::string& output_type_string = FormatOutputType(output_type);
50 const std::optional<OutputType> parsed = ParseOutputType(output_type_string);
51 assert(parsed);
52 assert(output_type == parsed.value());
53 (void)ParseOutputType(fuzzed_data_provider.ConsumeRandomLengthString(64));
54
55 const std::vector<uint8_t> bytes = ConsumeRandomLengthByteVector(fuzzed_data_provider);
56 const std::vector<bool> bits = BytesToBits(bytes);
57 const std::vector<uint8_t> bytes_decoded = BitsToBytes(bits);
58 assert(bytes == bytes_decoded);
59}

Callers

nothing calls this directly

Calls 13

JSONRPCTransactionErrorFunction · 0.85
TransactionErrorStringFunction · 0.85
ParseOutputTypeFunction · 0.85
BytesToBitsFunction · 0.85
BitsToBytesFunction · 0.85
PickValueInArrayMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected