diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile index d876602cf..f37f3f1b6 100644 --- a/tests/fuzz/Makefile +++ b/tests/fuzz/Makefile @@ -21,6 +21,7 @@ FUZZ_COMMON_OBJS := \ common/daemon.o \ common/daemon_conn.o \ common/derive_basepoints.o \ + common/descriptor_checksum.o \ common/fee_states.o \ common/htlc_state.o \ common/permute_tx.o \ diff --git a/tests/fuzz/fuzz-descriptor_checksum.c b/tests/fuzz/fuzz-descriptor_checksum.c new file mode 100644 index 000000000..c37412bd6 --- /dev/null +++ b/tests/fuzz/fuzz-descriptor_checksum.c @@ -0,0 +1,20 @@ +#include + +#include +#include + +void init(int *argc, char ***argv) +{ +} + +void run(const uint8_t *data, size_t size) +{ + char *string; + struct descriptor_checksum checksum; + + /* We should not crash nor overflow the checksum buffer. */ + + string = to_string(NULL, data, size); + descriptor_checksum(string, tal_count(string), &checksum); + tal_free(string); +}