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

Function run

tests/fuzz/fuzz-bigsize.c:11–35  ·  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 for (size_t chunk_size = 1; chunk_size <= BIGSIZE_MAX_LEN; chunk_size++) {
18 wire_chunks = get_chunks(NULL, data, size, chunk_size);
19 for (size_t i = 0; i < tal_count(wire_chunks); i++) {
20 wire_max = tal_count(wire_chunks[i]);
21 wire_ptr = wire_chunks[i];
22
23 bigsize_t bs = fromwire_bigsize(&wire_ptr, &wire_max), bs_decoded;
24 assert(bigsize_put(buff, bs) > 0);
25 assert(bigsize_len(bs));
26 assert(bigsize_get(buff, sizeof(buff), &bs_decoded) == bigsize_len(bs));
27 assert(bs_decoded == bs);
28
29 wire_buff = tal_arr(NULL, uint8_t, 8);
30 towire_bigsize(&wire_buff, bs);
31 tal_free(wire_buff);
32 }
33 tal_free(wire_chunks);
34 }
35}

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected