mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
fuzz: test bolt12 bech32 decoding
This commit is contained in:
parent
b19b08d749
commit
b73f921a91
@ -23,6 +23,7 @@ FUZZ_COMMON_OBJS := \
|
|||||||
common/bigsize.o \
|
common/bigsize.o \
|
||||||
common/blockheight_states.o \
|
common/blockheight_states.o \
|
||||||
common/bolt11.o \
|
common/bolt11.o \
|
||||||
|
common/bolt12_merkle.o \
|
||||||
common/channel_config.o \
|
common/channel_config.o \
|
||||||
common/close_tx.o \
|
common/close_tx.o \
|
||||||
common/configdir.o \
|
common/configdir.o \
|
||||||
@ -56,6 +57,7 @@ FUZZ_COMMON_OBJS := \
|
|||||||
common/type_to_string.o \
|
common/type_to_string.o \
|
||||||
common/utils.o \
|
common/utils.o \
|
||||||
common/version.o \
|
common/version.o \
|
||||||
|
wire/bolt12_wiregen.o \
|
||||||
wire/fromwire.o \
|
wire/fromwire.o \
|
||||||
wire/onion_wiregen.o \
|
wire/onion_wiregen.o \
|
||||||
wire/peer_wire.o \
|
wire/peer_wire.o \
|
||||||
|
21
tests/fuzz/fuzz-bolt12-bech32-decode.c
Normal file
21
tests/fuzz/fuzz-bolt12-bech32-decode.c
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* 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) { 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();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user