mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
fuzz: make it build again.
How did this pass CI? I saw this break in my PR, but it's (long) broken in master. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
67b790e3dc
commit
012dedc3d8
@@ -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 \
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "config.h"
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <tests/fuzz/libfuzz.h>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <bitcoin/tx.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/blockheight_states.h>
|
||||
#include <common/channel_type.h>
|
||||
#include <common/fee_states.h>
|
||||
#include <common/initial_channel.h>
|
||||
#include <common/setup.h>
|
||||
@@ -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.. */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user