Skip to content

Commit 7ac4c3b

Browse files
authored
Merge pull request #1316 from TheBlueMatt/2022-02-no-fuzztarget
Drop `fuzztarget` feature entirely
2 parents 84c3f51 + b0cb558 commit 7ac4c3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+197
-83
lines changed

fuzz/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Automatically generated"]
55
publish = false
66
# Because the function is unused it gets dropped before we link lightning, so
77
# we have to duplicate build.rs here. Note that this is only required for
8-
# fuzztarget mode.
8+
# fuzzing mode.
99

1010
[package.metadata]
1111
cargo-fuzz = true
@@ -18,7 +18,7 @@ stdin_fuzz = []
1818

1919
[dependencies]
2020
afl = { version = "0.4", optional = true }
21-
lightning = { path = "../lightning", features = ["fuzztarget"] }
21+
lightning = { path = "../lightning", features = ["regex"] }
2222
bitcoin = { version = "0.27", features = ["fuzztarget", "secp-lowmemory"] }
2323
hex = "0.3"
2424
honggfuzz = { version = "0.5", optional = true }

fuzz/src/bin/chanmon_consistency_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::chanmon_consistency::*;
1720

fuzz/src/bin/chanmon_deser_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::chanmon_deser::*;
1720

fuzz/src/bin/full_stack_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::full_stack::*;
1720

fuzz/src/bin/msg_accept_channel_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_accept_channel::*;
1720

fuzz/src/bin/msg_announcement_signatures_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_announcement_signatures::*;
1720

fuzz/src/bin/msg_channel_announcement_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_channel_announcement::*;
1720

fuzz/src/bin/msg_channel_reestablish_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_channel_reestablish::*;
1720

fuzz/src/bin/msg_channel_update_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_channel_update::*;
1720

fuzz/src/bin/msg_closing_signed_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_closing_signed::*;
1720

fuzz/src/bin/msg_commitment_signed_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_commitment_signed::*;
1720

fuzz/src/bin/msg_decoded_onion_error_packet_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_decoded_onion_error_packet::*;
1720

fuzz/src/bin/msg_error_message_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_error_message::*;
1720

fuzz/src/bin/msg_funding_created_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_funding_created::*;
1720

fuzz/src/bin/msg_funding_locked_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_funding_locked::*;
1720

fuzz/src/bin/msg_funding_signed_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_funding_signed::*;
1720

fuzz/src/bin/msg_gossip_timestamp_filter_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_gossip_timestamp_filter::*;
1720

fuzz/src/bin/msg_init_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_init::*;
1720

fuzz/src/bin/msg_node_announcement_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_node_announcement::*;
1720

fuzz/src/bin/msg_onion_hop_data_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_onion_hop_data::*;
1720

fuzz/src/bin/msg_open_channel_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_open_channel::*;
1720

fuzz/src/bin/msg_ping_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_ping::*;
1720

fuzz/src/bin/msg_pong_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_pong::*;
1720

fuzz/src/bin/msg_query_channel_range_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_query_channel_range::*;
1720

fuzz/src/bin/msg_query_short_channel_ids_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_query_short_channel_ids::*;
1720

fuzz/src/bin/msg_reply_channel_range_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_reply_channel_range::*;
1720

fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_reply_short_channel_ids_end::*;
1720

fuzz/src/bin/msg_revoke_and_ack_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_revoke_and_ack::*;
1720

fuzz/src/bin/msg_shutdown_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_shutdown::*;
1720

fuzz/src/bin/msg_update_add_htlc_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_update_add_htlc::*;
1720

fuzz/src/bin/msg_update_fail_htlc_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_update_fail_htlc::*;
1720

fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_update_fail_malformed_htlc::*;
1720

fuzz/src/bin/msg_update_fee_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_update_fee::*;
1720

fuzz/src/bin/msg_update_fulfill_htlc_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::msg_targets::msg_update_fulfill_htlc::*;
1720

fuzz/src/bin/peer_crypt_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::peer_crypt::*;
1720

fuzz/src/bin/router_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::router::*;
1720

fuzz/src/bin/target_template.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::TARGET_MOD::*;
1720

fuzz/src/bin/zbase32_target.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#![cfg_attr(feature = "libfuzzer_fuzz", no_main)]
1414

15+
#[cfg(not(fuzzing))]
16+
compile_error!("Fuzz targets need cfg=fuzzing");
17+
1518
extern crate lightning_fuzz;
1619
use lightning_fuzz::zbase32::*;
1720

lightning-invoice/fuzz/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ honggfuzz_fuzz = ["honggfuzz"]
1414
[dependencies]
1515
honggfuzz = { version = "0.5", optional = true }
1616
afl = { version = "0.4", optional = true }
17-
lightning-invoice = { path = ".."}
17+
lightning-invoice = { path = ".." }
18+
lightning = { path = "../../lightning", features = ["regex"] }
1819
bech32 = "0.8"
1920

2021
# Prevent this from interfering with workspaces

0 commit comments

Comments
 (0)