Fix atheris fmt, clippy (#1769)

This commit is contained in:
Dominik Maier 2024-01-02 23:12:37 +01:00 committed by GitHub
parent 925b33889f
commit d143cac663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@
//! This is the drop-in replacement for libfuzzer, to be used together with [`Atheris`](https://github.com/google/atheris) //! This is the drop-in replacement for libfuzzer, to be used together with [`Atheris`](https://github.com/google/atheris)
//! for python instrumentation and fuzzing. //! for python instrumentation and fuzzing.
use core::{convert::TryInto, ffi::c_void, slice, time::Duration}; use core::time::Duration;
use std::{ use std::{
env, env,
os::raw::{c_char, c_int}, os::raw::{c_char, c_int},
@ -39,7 +39,7 @@ use libafl_bolts::{
tuples::{tuple_list, Merge}, tuples::{tuple_list, Merge},
AsSlice, AsSlice,
}; };
use libafl_targets::{extra_counters, std_edges_map_observer, CmpLogObserver}; use libafl_targets::{extra_counters, CmpLogObserver};
/// It's called by Atheris after the fuzzer has been initialized. /// It's called by Atheris after the fuzzer has been initialized.
/// The main entrypoint to our fuzzer, which will be called by `Atheris` when fuzzing starts. /// The main entrypoint to our fuzzer, which will be called by `Atheris` when fuzzing starts.
@ -95,7 +95,7 @@ pub extern "C" fn LLVMFuzzerRunDriver(
.get_matches(); .get_matches();
let workdir = env::current_dir().unwrap(); let workdir = env::current_dir().unwrap();
println!("{}", env::current_dir().unwrap().to_string_lossy().to_string()); println!("{}", env::current_dir().unwrap().to_string_lossy());
let cores = Cores::from_cmdline(matches.get_one::<String>("cores").unwrap()) let cores = Cores::from_cmdline(matches.get_one::<String>("cores").unwrap())
.expect("No valid core count given!"); .expect("No valid core count given!");
@ -133,8 +133,7 @@ pub extern "C" fn LLVMFuzzerRunDriver(
// Create an observation channel using the coverage map // Create an observation channel using the coverage map
let edges = unsafe { extra_counters() }; let edges = unsafe { extra_counters() };
println!("edges: {:?}", edges); println!("edges: {:?}", edges);
let edges_observer; let edges_observer = HitcountsMapObserver::new(StdMapObserver::from_mut_slice(
edges_observer = HitcountsMapObserver::new(StdMapObserver::from_mut_slice(
"edges", "edges",
edges.into_iter().next().unwrap(), edges.into_iter().next().unwrap(),
)); ));