Skip to content

Commit a536ebe

Browse files
Fix all clippy warnings in baby_fuzzers (#3553)
* feat: fixed all warnings according to clippy, rename .cargo/config files to .cargo/config.toml, fix syntax issue in harness.c in c_code_with_inprocess_executor * fix: format TOML files using taplo * fix: format main.rs in baby_fuzzer_custom_executor * fix: remove commented-out unnecessary line from baby_fuzzer/src/main.rs
1 parent 47ca338 commit a536ebe

File tree

14 files changed

+13
-20
lines changed

14 files changed

+13
-20
lines changed

fuzzers/baby/baby_fuzzer/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ fn signals_set(idx: usize) {
3434
unsafe { write(SIGNALS_PTR.add(idx), 1) };
3535
}
3636

37-
#[expect(clippy::manual_assert)]
3837
pub fn main() {
3938
env_logger::init();
4039
// The closure that we want to fuzz
@@ -56,7 +55,8 @@ pub fn main() {
5655
// https://github.com/googleprojectzero/winafl/blob/ea5f6b85572980bb2cf636910f622f36906940aa/winafl.c#L728
5756
#[cfg(windows)]
5857
unsafe {
59-
write_volatile(0 as *mut u32, 0);
58+
// Replace zero-ptr with the below function, suggested by Clippy
59+
write_volatile(std::ptr::null_mut::<u32>(), 0);
6060
}
6161
}
6262
}

fuzzers/baby/baby_fuzzer_custom_executor/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#[cfg(windows)]
2-
use std::ptr::write_volatile;
31
use std::{marker::PhantomData, path::PathBuf, ptr::write};
42

3+
#[cfg(feature = "bloom_input_filter")]
4+
use libafl::fuzzer::{BloomInputFilter, ReportingInputFilter};
55
#[cfg(feature = "tui")]
66
use libafl::monitors::tui::TuiMonitor;
77
#[cfg(not(feature = "tui"))]
@@ -12,7 +12,7 @@ use libafl::{
1212
executors::{Executor, ExitKind, WithObservers},
1313
feedback_and_fast,
1414
feedbacks::{CrashFeedback, MaxMapFeedback},
15-
fuzzer::{BloomInputFilter, Fuzzer, ReportingInputFilter, StdFuzzer},
15+
fuzzer::{Fuzzer, StdFuzzer},
1616
generators::RandPrintablesGenerator,
1717
inputs::HasTargetBytes,
1818
mutators::{havoc_mutations::havoc_mutations, scheduled::HavocScheduledMutator},

fuzzers/baby/baby_fuzzer_minimizing/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#[cfg(windows)]
2-
use std::ptr::write_volatile;
31
use std::{path::PathBuf, ptr::write};
42

53
use libafl::prelude::*;

fuzzers/baby/baby_fuzzer_swap_differential/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#[cfg(windows)]
2-
use std::ptr::write_volatile;
31
use std::{
42
alloc::{alloc_zeroed, Layout},
53
path::PathBuf,

fuzzers/baby/baby_fuzzer_unicode/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ fn signals_set(idx: usize) {
3535
unsafe { write(SIGNALS_PTR.add(idx), 1) };
3636
}
3737

38-
#[expect(clippy::manual_assert)]
3938
pub fn main() {
4039
// The closure that we want to fuzz
4140
let mut harness = |input: &BytesInput| {
@@ -53,7 +52,7 @@ pub fn main() {
5352

5453
#[cfg(windows)]
5554
unsafe {
56-
write_volatile(0 as *mut u32, 0);
55+
write_volatile(std::ptr::null_mut::<u32>(), 0);
5756
}
5857
}
5958
ExitKind::Ok

fuzzers/baby/backtrace_baby_fuzzers/c_code_with_fork_executor/.cargo/config

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
rustflags = ["-Cforce-unwind-tables=y"]

fuzzers/baby/backtrace_baby_fuzzers/c_code_with_fork_executor/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use libafl::{
1818
};
1919
use libafl_bolts::{
2020
nonzero,
21-
ownedref::OwnedRefMut,
2221
rands::StdRand,
2322
shmem::{ShMemProvider, StdShMemProvider},
2423
tuples::tuple_list,

fuzzers/baby/backtrace_baby_fuzzers/c_code_with_inprocess_executor/.cargo/config

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
rustflags = ["-Cforce-unwind-tables=y"]

0 commit comments

Comments
 (0)