Files
palladum-lightning/tests/fuzz/fuzz-bolt12-bech32-decode.c

27 lines
609 B
C
Raw Normal View History

2023-10-26 14:38:09 -05:00
/* 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"
2023-10-26 14:38:09 -05:00
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");
}
2023-10-26 14:38:09 -05:00
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();
}