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

Function run

tests/fuzz/fuzz-bigsize.c:11–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9}
10
11void run(const uint8_t *data, size_t size)
12{
13 uint8_t *wire_buff, buff[BIGSIZE_MAX_LEN];
14 const uint8_t **wire_chunks, *wire_ptr;
15 size_t wire_max;
16
17 wire_chunks = get_chunks(NULL, data, size, 8);
18 for (size_t i = 0; i < tal_count(wire_chunks); i++) {
19 wire_max = tal_count(wire_chunks[i]);
20 wire_ptr = wire_chunks[i];
21
22 bigsize_t bs = fromwire_bigsize(&wire_ptr, &wire_max);
23 if (bs != 0) {
24 /* We have a valid bigsize type, now we should not error. */
25 assert(bigsize_put(buff, bs) > 0);
26 assert(bigsize_len(bs));
27
28 wire_buff = tal_arr(NULL, uint8_t, 8);
29 towire_bigsize(&wire_buff, bs);
30 tal_free(wire_buff);
31 }
32 }
33 tal_free(wire_chunks);
34}

Callers

nothing calls this directly

Calls 6

get_chunksFunction · 0.85
bigsize_lenFunction · 0.85
tal_freeFunction · 0.85
fromwire_bigsizeFunction · 0.50
bigsize_putFunction · 0.50
towire_bigsizeFunction · 0.50

Tested by

no test coverage detected