diff --git a/libafl/src/corpus/minset.rs b/libafl/src/corpus/minset.rs index 2111d68d9e..0afaa156a1 100644 --- a/libafl/src/corpus/minset.rs +++ b/libafl/src/corpus/minset.rs @@ -32,11 +32,11 @@ where pub struct MinimizerCorpusScheduler where -CS: CorpusScheduler, -F: FavFactor, -I: Input, -S: HasCorpus, -C: Corpus + CS: CorpusScheduler, + F: FavFactor, + I: Input, + S: HasCorpus, + C: Corpus, { base: CS, phantom: PhantomData<(C, F, I, S)>, @@ -44,11 +44,11 @@ C: Corpus impl CorpusScheduler for MinimizerCorpusScheduler where -CS: CorpusScheduler, -F: FavFactor, -I: Input, -S: HasCorpus, -C: Corpus + CS: CorpusScheduler, + F: FavFactor, + I: Input, + S: HasCorpus, + C: Corpus, { /// Add an entry to the corpus and return its index fn on_add(&self, state: &mut S, idx: usize) -> Result<(), Error> { @@ -83,7 +83,7 @@ where F: FavFactor, I: Input, S: HasCorpus, - C: Corpus + C: Corpus, { /*pub fn update_score(&self, state: &mut S, idx: usize) -> Result<(), Error> { let entry = state.corpus().get(idx)?.borrow_mut(); @@ -94,7 +94,7 @@ where continue } } - + let _ = self.top_rated.insert(elem, idx); } }*/ diff --git a/libafl/src/corpus/mod.rs b/libafl/src/corpus/mod.rs index 366bce49f3..0707f3d9be 100644 --- a/libafl/src/corpus/mod.rs +++ b/libafl/src/corpus/mod.rs @@ -15,8 +15,9 @@ pub mod queue; pub use queue::QueueCorpusScheduler; pub mod minset; -use core::cell::RefCell; -use core::marker::PhantomData; + +use alloc::borrow::ToOwned; +use core::{cell::RefCell, marker::PhantomData}; use crate::{ inputs::Input, diff --git a/libafl/src/events/llmp.rs b/libafl/src/events/llmp.rs index 2d7e82aaa8..a9c83155d7 100644 --- a/libafl/src/events/llmp.rs +++ b/libafl/src/events/llmp.rs @@ -255,7 +255,7 @@ where fn handle_in_client( &mut self, state: &mut S, - sender_id: u32, + _sender_id: u32, event: Event, _executor: &mut E, ) -> Result<(), Error> @@ -275,7 +275,7 @@ where // TODO: here u should match client_config, if equal to the current one do not re-execute // we need to pass engine to process() too, TODO #[cfg(feature = "std")] - println!("Received new Testcase from {}", sender_id); + println!("Received new Testcase from {}", _sender_id); let observers: OT = postcard::from_bytes(&observers_buf)?; // TODO include ExitKind in NewTestcase diff --git a/libafl/src/events/logger.rs b/libafl/src/events/logger.rs index ba3761ac32..65c05dee7b 100644 --- a/libafl/src/events/logger.rs +++ b/libafl/src/events/logger.rs @@ -1,8 +1,6 @@ use alloc::{string::ToString, vec::Vec}; use core::marker::PhantomData; -#[cfg(feature = "std")] -#[cfg(unix)] use crate::{ events::{BrokerEventResult, Event, EventManager}, executors::{Executor, HasObservers}, diff --git a/libafl/src/events/mod.rs b/libafl/src/events/mod.rs index d801f46aaa..c485101bd1 100644 --- a/libafl/src/events/mod.rs +++ b/libafl/src/events/mod.rs @@ -5,6 +5,7 @@ pub use logger::*; pub mod llmp; pub use llmp::*; +use alloc::{string::String, vec::Vec}; use core::{fmt, marker::PhantomData, time::Duration}; use serde::{Deserialize, Serialize}; @@ -218,11 +219,15 @@ where #[cfg(test)] mod tests { - use crate::bolts::tuples::tuple_list; - use crate::events::Event; - use crate::inputs::bytes::BytesInput; - use crate::observers::StdMapObserver; - use crate::utils::current_time; + use tuple_list::tuple_list_type; + + use crate::{ + bolts::tuples::{tuple_list, Named}, + events::Event, + inputs::bytes::BytesInput, + observers::StdMapObserver, + utils::current_time, + }; static mut MAP: [u32; 4] = [0; 4]; @@ -254,10 +259,9 @@ mod tests { time: _, executions: _, } => { - let o: tuple_list!(StdMapObserver::) = + let o: tuple_list_type!(StdMapObserver::) = postcard::from_bytes(&observers_buf).unwrap(); - let test_observer = o.match_name_type::>("test").unwrap(); - assert_eq!("test", test_observer.name()); + assert_eq!("test", o.0.name()); } _ => panic!("mistmatch"), }; diff --git a/libafl/src/executors/inprocess.rs b/libafl/src/executors/inprocess.rs index feb4bc5a37..8945e69882 100644 --- a/libafl/src/executors/inprocess.rs +++ b/libafl/src/executors/inprocess.rs @@ -53,14 +53,19 @@ where OT: ObserversTuple, { #[inline] - fn pre_exec(&mut self, state: &mut S, event_mgr: &mut EM, input: &I) -> Result<(), Error> + fn pre_exec( + &mut self, + _state: &mut S, + _event_mgr: &mut EM, + _input: &I, + ) -> Result<(), Error> where EM: EventManager, { #[cfg(unix)] #[cfg(feature = "std")] unsafe { - set_oncrash_ptrs(state, event_mgr, self.observers(), input); + set_oncrash_ptrs(_state, _event_mgr, self.observers(), _input); } Ok(()) } diff --git a/libafl/src/inputs/mod.rs b/libafl/src/inputs/mod.rs index 18b9b6a518..6d00b34c4e 100644 --- a/libafl/src/inputs/mod.rs +++ b/libafl/src/inputs/mod.rs @@ -32,11 +32,8 @@ pub trait Input: Clone + serde::Serialize + serde::de::DeserializeOwned + Debug #[cfg(not(feature = "std"))] /// Write this input to the file - fn to_file

(&self, _path: P) -> Result<(), Error> - where - P: AsRef, - { - Err(Error::NotImplemented("Not suppored in no_std".into())) + fn to_file

(&self, _path: P) -> Result<(), Error> { + Err(Error::NotImplemented("Not supported in no_std".into())) } /// Load the contents of this input from a file @@ -53,11 +50,8 @@ pub trait Input: Clone + serde::Serialize + serde::de::DeserializeOwned + Debug /// Write this input to the file #[cfg(not(feature = "std"))] - fn from_file

(_path: P) -> Result - where - P: AsRef, - { - Err(Error::NotImplemented("Not suppored in no_std".into())) + fn from_file

(_path: P) -> Result { + Err(Error::NotImplemented("Not supprted in no_std".into())) } } diff --git a/libafl/src/lib.rs b/libafl/src/lib.rs index c8f30e87d3..ff2b795100 100644 --- a/libafl/src/lib.rs +++ b/libafl/src/lib.rs @@ -8,6 +8,7 @@ Welcome to libAFL extern crate alloc; #[macro_use] extern crate static_assertions; +#[cfg(feature = "std")] #[macro_use] extern crate ctor; diff --git a/libafl/src/observers/mod.rs b/libafl/src/observers/mod.rs index 09b126bb07..379566902a 100644 --- a/libafl/src/observers/mod.rs +++ b/libafl/src/observers/mod.rs @@ -1,7 +1,10 @@ pub mod map; pub use map::*; -use alloc::string::{String, ToString}; +use alloc::{ + string::{String, ToString}, + vec::Vec, +}; use core::time::Duration; use serde::{Deserialize, Serialize};