Files
palladum-lightning/tests/fuzz/fuzz-bolt12-bech32-decode.c
Rusty Russell 2adfdfd0d9 Makefile: run fuzzing corpora as normal unit tests in non-fuzzing mode.
This means we can make sure the compile and run in normal builds.

Side note: various tests call common_setup(), which means we called it
twice in unit testing mode, so we conditionalize those.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-23 06:44:04 +10:30

27 lines
609 B
C

/* A fuzz target for the bolt12-specific bech32 decoding logic. */
#include "config.h"
#include <common/setup.h>
#include <common/utils.h>
#include <stddef.h>
#include <tests/fuzz/libfuzz.h>
/* Include bolt12.c directly, to gain access to string_to_data(). */
#include "../../common/bolt12.c"
void init(int *argc, char ***argv)
{
/* Don't call this if we're in unit-test mode, as libfuzz.c does it */
if (!tmpctx)
common_setup("fuzzer");
}
void run(const u8 *data, size_t size)
{
size_t dlen;
char *fail;
string_to_data(tmpctx, (const char *)data, size, "lno", &dlen, &fail);
clean_tmpctx();
}