mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
fuzz: add a fuzz target for common/descriptor_checksum
A small one just to check that we don't crash nor go out of bounds! Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
committed by
neil saitug
parent
bf0a2f2b85
commit
4f2ae48c54
@@ -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 \
|
||||
|
||||
20
tests/fuzz/fuzz-descriptor_checksum.c
Normal file
20
tests/fuzz/fuzz-descriptor_checksum.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <tests/fuzz/libfuzz.h>
|
||||
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <common/descriptor_checksum.h>
|
||||
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user