diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile index 602ee5e0f..6a6c35fa7 100644 --- a/tests/fuzz/Makefile +++ b/tests/fuzz/Makefile @@ -10,18 +10,22 @@ FUZZ_TARGETS_BIN := $(FUZZ_TARGETS_SRC:.c=) FUZZ_COMMON_OBJS := \ common/amount.o \ common/addr.o \ + common/autodata.o \ common/base32.o \ common/base64.o \ common/bech32.o \ common/bip32.o \ common/bigsize.o \ + common/blockheight_states.o \ common/channel_config.o \ common/close_tx.o \ common/channel_id.o \ + common/channel_type.o \ common/daemon.o \ common/daemon_conn.o \ common/derive_basepoints.o \ common/descriptor_checksum.o \ + common/features.o \ common/fee_states.o \ common/hsm_encryption.o \ common/htlc_state.o \ @@ -46,7 +50,8 @@ FUZZ_COMMON_OBJS := \ wire/fromwire.o \ wire/onion_wiregen.o \ wire/peer_wire.o \ - wire/peer_wiregen.o \ + wire/peer$(EXP)_wiregen.o \ + wire/channel_type_wiregen.o \ wire/tlvstream.o \ wire/towire.o \ wire/wire_io.o \ diff --git a/tests/fuzz/fuzz-bech32.c b/tests/fuzz/fuzz-bech32.c index b3ab46f44..9acac0605 100644 --- a/tests/fuzz/fuzz-bech32.c +++ b/tests/fuzz/fuzz-bech32.c @@ -1,3 +1,5 @@ +#include "config.h" +#include #include #include #include diff --git a/tests/fuzz/fuzz-initial_channel.c b/tests/fuzz/fuzz-initial_channel.c index 06e1e89bd..df2b34177 100644 --- a/tests/fuzz/fuzz-initial_channel.c +++ b/tests/fuzz/fuzz-initial_channel.c @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include #include @@ -38,7 +40,8 @@ void run(const uint8_t *data, size_t size) struct channel_config local, remote; struct basepoints local_basepoints, remote_basepoints; struct pubkey local_funding_pubkey, remote_funding_pubkey; - bool option_static_remotekey, option_anchor_outputs; + bool option_static_remotekey, option_anchor_outputs, wumbo; + struct channel_type *channel_type; struct channel *channel; fromwire_channel_id(&data, &size, &cid); @@ -59,9 +62,17 @@ void run(const uint8_t *data, size_t size) fromwire_basepoints(&data, &size, &remote_basepoints); fromwire_pubkey(&data, &size, &local_funding_pubkey); fromwire_pubkey(&data, &size, &remote_funding_pubkey); + wumbo = fromwire_bool(&data, &size); option_anchor_outputs = fromwire_bool(&data, &size); option_static_remotekey = option_anchor_outputs || fromwire_bool(&data, &size); + if (option_anchor_outputs) + channel_type = channel_type_anchor_outputs(tmpctx); + else if (option_static_remotekey) + channel_type = channel_type_static_remotekey(tmpctx); + else + channel_type = channel_type_none(tmpctx); + /* TODO: determine if it makes sense to check at each step for libfuzzer * to deduce pertinent inputs */ if (!data || !size) @@ -81,8 +92,8 @@ void run(const uint8_t *data, size_t size) &remote_basepoints, &local_funding_pubkey, &remote_funding_pubkey, - option_static_remotekey, - option_anchor_outputs, opener); + channel_type, + wumbo, opener); /* TODO: make initial_channel_tx() work with ASAN.. */ }