fuzz: remove AFL support

AFAICT we literally never used this; it was available only on the
bitcoin targets and not the honggfuzz ones; AFL has a broken dep
tree (or at least, requires some more MSRV pins that I did not care
to investigate).

Just remove it entirely.
This commit is contained in:
Andrew Poelstra 2023-03-22 18:03:04 +00:00
parent ab467cb091
commit fd88e48696
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
22 changed files with 32 additions and 194 deletions

View File

@ -8,14 +8,8 @@ publish = false
[package.metadata]
cargo-fuzz = true
[features]
default = ["honggfuzz_fuzz"]
afl_fuzz = ["afl"]
honggfuzz_fuzz = ["honggfuzz"]
[dependencies]
honggfuzz = { version = "0.5", optional = true, default-features = false }
afl = { version = "0.4", optional = true }
honggfuzz = { version = "0.5", default-features = false }
bitcoin = { version = "0.30.0", features = [ "serde" ] }
rust-crypto = "0.2"

View File

@ -10,7 +10,6 @@ REPO_DIR=$(git rev-parse --show-toplevel)
# shellcheck source=./fuzz-util.sh
source "$REPO_DIR/fuzz/fuzz-util.sh"
export HFUZZ_BUILD_ARGS='--features honggfuzz_fuzz'
while :
do
for targetFile in $(listTargetFiles); do

View File

@ -28,7 +28,7 @@ for targetFile in $targetFiles; do
else
HFUZZ_INPUT_ARGS=""
fi
HFUZZ_BUILD_ARGS="--features honggfuzz_fuzz" HFUZZ_RUN_ARGS="--run_time 30 --exit_upon_crash -v $HFUZZ_INPUT_ARGS" cargo hfuzz run "$targetName"
HFUZZ_RUN_ARGS="--run_time 30 --exit_upon_crash -v $HFUZZ_INPUT_ARGS" cargo hfuzz run "$targetName"
checkReport "$targetName"
done

View File

@ -1,21 +1,10 @@
extern crate bitcoin;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let _: Result<bitcoin::network::message::RawNetworkMessage, _> = bitcoin::consensus::encode::deserialize(data);
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,5 +1,7 @@
extern crate bitcoin;
use honggfuzz::fuzz;
use std::str::FromStr;
fn do_test(data: &[u8]) {
let data_str = String::from_utf8_lossy(data);
let addr = match bitcoin::address::Address::from_str(&data_str) {
@ -9,18 +11,6 @@ fn do_test(data: &[u8]) {
assert_eq!(addr.to_string(), data_str);
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,5 +1,7 @@
extern crate bitcoin;
use honggfuzz::fuzz;
use std::str::FromStr;
fn do_test(data: &[u8]) {
let data_str = String::from_utf8_lossy(data);
@ -26,18 +28,6 @@ fn do_test(data: &[u8]) {
assert_eq!(amt, amt_roundtrip);
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,21 +1,10 @@
extern crate bitcoin;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let _: Result<bitcoin::blockdata::block::Block, _>= bitcoin::consensus::encode::deserialize(data);
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,4 +1,5 @@
extern crate bitcoin;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
// We already fuzz Transactions in `./deserialize_transaction.rs`.
@ -13,18 +14,6 @@ fn do_test(data: &[u8]) {
}
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,4 +1,5 @@
extern crate bitcoin;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let psbt: Result<bitcoin::psbt::PartiallySignedTransaction, _> = bitcoin::psbt::Psbt::deserialize(data);
@ -13,18 +14,6 @@ fn do_test(data: &[u8]) {
}
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,4 +1,5 @@
extern crate bitcoin;
use honggfuzz::fuzz;
use bitcoin::address::Address;
use bitcoin::network::constants::Network;
@ -43,18 +44,6 @@ fn do_test(data: &[u8]) {
}
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,4 +1,5 @@
extern crate bitcoin;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let tx_result: Result<bitcoin::blockdata::transaction::Transaction, _> = bitcoin::consensus::encode::deserialize(data);
@ -25,18 +26,6 @@ fn do_test(data: &[u8]) {
}
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,4 +1,5 @@
extern crate bitcoin;
use honggfuzz::fuzz;
use bitcoin::consensus::{serialize, deserialize};
use bitcoin::blockdata::witness::Witness;
@ -11,18 +12,6 @@ fn do_test(data: &[u8]) {
}
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,5 +1,5 @@
extern crate bitcoin;
use honggfuzz::fuzz;
use bitcoin::blockdata::transaction::OutPoint;
use bitcoin::consensus::encode;
@ -40,18 +40,6 @@ fn do_test(data: &[u8]) {
}
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,5 +1,5 @@
extern crate bitcoin;
use honggfuzz::fuzz;
use std::fmt;
// faster than String, we don't need to actually produce the value, just check absence of panics
@ -20,18 +20,6 @@ fn do_test(data: &[u8]) {
bitcoin::Script::from_bytes(data).fmt_asm(&mut writer);
}
#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
do_test(&data);
});
}
#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|data| {

View File

@ -1,6 +1,7 @@
use bitcoin::hashes::Hmac;
use bitcoin::hashes::{sha1, sha512, ripemd160, sha256d};
use honggfuzz::fuzz;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
@ -23,11 +24,6 @@ fn do_test(data: &[u8]) {
}
}
#[cfg(feature = "honggfuzz")]
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|d| { do_test(d) });

View File

@ -1,6 +1,7 @@
use bitcoin::hashes::Hmac;
use bitcoin::hashes::{sha1, sha512, ripemd160, sha256d};
use honggfuzz::fuzz;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
@ -23,11 +24,6 @@ fn do_test(data: &[u8]) {
}
}
#[cfg(feature = "honggfuzz")]
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|d| { do_test(d) });

View File

@ -3,6 +3,7 @@ use bitcoin::hashes::Hash;
use bitcoin::hashes::ripemd160;
use crypto::digest::Digest;
use crypto::ripemd160::Ripemd160;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let our_hash = ripemd160::Hash::hash(data);
@ -15,11 +16,6 @@ fn do_test(data: &[u8]) {
assert_eq!(&our_hash[..], &rc_hash[..]);
}
#[cfg(feature = "honggfuzz")]
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|d| { do_test(d) });

View File

@ -3,6 +3,7 @@ use bitcoin::hashes::Hash;
use bitcoin::hashes::sha1;
use crypto::digest::Digest;
use crypto::sha1::Sha1;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let our_hash = sha1::Hash::hash(data);
@ -15,11 +16,6 @@ fn do_test(data: &[u8]) {
assert_eq!(&our_hash[..], &rc_hash[..]);
}
#[cfg(feature = "honggfuzz")]
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|d| { do_test(d) });

View File

@ -3,6 +3,7 @@ use bitcoin::hashes::Hash;
use bitcoin::hashes::sha256;
use crypto::digest::Digest;
use crypto::sha2::Sha256;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let our_hash = sha256::Hash::hash(data);
@ -15,11 +16,6 @@ fn do_test(data: &[u8]) {
assert_eq!(&our_hash[..], &rc_hash[..]);
}
#[cfg(feature = "honggfuzz")]
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|d| { do_test(d) });

View File

@ -3,6 +3,7 @@ use bitcoin::hashes::Hash;
use bitcoin::hashes::sha512;
use crypto::digest::Digest;
use crypto::sha2::Sha512;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let our_hash = sha512::Hash::hash(data);
@ -15,11 +16,6 @@ fn do_test(data: &[u8]) {
assert_eq!(&our_hash[..], &rc_hash[..]);
}
#[cfg(feature = "honggfuzz")]
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|d| { do_test(d) });

View File

@ -3,6 +3,7 @@ use bitcoin::hashes::Hash;
use bitcoin::hashes::sha512_256;
use crypto::digest::Digest;
use crypto::sha2::Sha512Trunc256;
use honggfuzz::fuzz;
fn do_test(data: &[u8]) {
let our_hash = sha512_256::Hash::hash(data);
@ -15,11 +16,6 @@ fn do_test(data: &[u8]) {
assert_eq!(&our_hash[..], &rc_hash[..]);
}
#[cfg(feature = "honggfuzz")]
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
fuzz!(|d| { do_test(d) });

View File

@ -19,14 +19,8 @@ publish = false
[package.metadata]
cargo-fuzz = true
[features]
default = ["honggfuzz_fuzz"]
afl_fuzz = ["afl"]
honggfuzz_fuzz = ["honggfuzz"]
[dependencies]
honggfuzz = { version = "0.5", optional = true, default-features = false }
afl = { version = "0.4", optional = true }
honggfuzz = { version = "0.5", default-features = false }
bitcoin = { version = "0.30.0", features = [ "serde" ] }
rust-crypto = "0.2"