MCPcopy Create free account
hub / github.com/ElementsProject/lightning / initial_input

Function initial_input

tests/fuzz/bolt12.h:35–52  ·  view source on GitHub ↗

Encodes a dummy bolt12 offer/invoice-request/invoice into fuzz_data and * returns the size of the encoded string. */

Source from the content-addressed store, hash-verified

33/* Encodes a dummy bolt12 offer/invoice-request/invoice into fuzz_data and
34 * returns the size of the encoded string. */
35static size_t initial_input(u8 *fuzz_data, size_t size, size_t max_size)
36{
37 static char *dummy;
38 static size_t dummy_size;
39 if (!dummy) {
40 /* Initialize dummy to bech32_hrp followed by '1'. */
41 size_t bech32_hrp_len = strlen(bech32_hrp);
42 dummy = tal_dup_arr(NULL, char, bech32_hrp, bech32_hrp_len, 1);
43 dummy[bech32_hrp_len] = '1';
44 dummy_size = bech32_hrp_len + 1;
45 }
46
47 size = max_size < dummy_size ? max_size : dummy_size;
48 memcpy(fuzz_data, dummy, size);
49
50 clean_tmpctx();
51 return size;
52}
53
54/* A custom mutator that decodes the bech32 input, mutates the decoded input,
55 * and then re-encodes the mutated input. This produces an input corpus that

Callers 1

LLVMFuzzerCustomMutatorFunction · 0.70

Calls 1

clean_tmpctxFunction · 0.85

Tested by

no test coverage detected