diff --git a/afl/src/events/mod.rs b/afl/src/events/mod.rs index 7238b0f327..58fc988c26 100644 --- a/afl/src/events/mod.rs +++ b/afl/src/events/mod.rs @@ -55,7 +55,7 @@ where } /// Events sent around in the library -#[derive(Serialize, Deserialize)] +#[derive(Serialize, Deserialize, Clone, Debug)] #[serde(bound = "I: serde::de::DeserializeOwned")] pub enum Event where @@ -232,6 +232,13 @@ where /// Broker fun fn handle_in_broker(&mut self, event: &Event) -> Result { match event { + Event::LoadInitial { + sender_id: _, + phantom: _, + } => { + self.corpus_size_inc(); + Ok(BrokerEventResult::Handled) + }, Event::NewTestcase { sender_id: _, input: _, @@ -249,7 +256,7 @@ where } Event::UpdateStats { sender_id, - executions: _, + executions, execs_over_sec: _, phantom: _, } => { @@ -263,7 +270,8 @@ where executions: 0, }) } - let stat = &mut self.client_stats_mut()[*sender_id as usize]; + let mut stat = &mut self.client_stats_mut()[*sender_id as usize]; + stat.executions = *executions as u64; println!( "[UPDATE] corpus: {} execs: {} execs/s: {}", self.corpus_size(), @@ -323,7 +331,7 @@ where Ok(()) } _ => Err(AflError::Unknown( - "Received illegal message that message should not have arrived.".into(), + format!("Received illegal message that message should not have arrived: {:?}.", event), )), } } @@ -462,11 +470,8 @@ where //CE: CustomEvent, { writer: W, - count: usize, // stats (maybe we need a separated struct?) - executions: usize, - execs_over_sec: u64, corpus_size: usize, start_time: time::Duration, client_stats: Vec, diff --git a/afl/src/inputs/mod.rs b/afl/src/inputs/mod.rs index c1b227802d..67990ef721 100644 --- a/afl/src/inputs/mod.rs +++ b/afl/src/inputs/mod.rs @@ -3,6 +3,7 @@ pub use bytes::BytesInput; use alloc::vec::Vec; use core::clone::Clone; +use core::fmt::Debug; #[cfg(feature = "std")] use std::fs::File; @@ -14,7 +15,7 @@ use std::path::Path; use crate::AflError; /// An input for the target -pub trait Input: Clone + serde::Serialize + serde::de::DeserializeOwned { +pub trait Input: Clone + serde::Serialize + serde::de::DeserializeOwned + Debug { #[cfg(feature = "std")] /// Write this input to the file fn to_file

(&self, path: P) -> Result<(), AflError> diff --git a/fuzzers/libfuzzer/src/lib.rs b/fuzzers/libfuzzer/src/lib.rs index 2b54b8326f..b241ee618e 100644 --- a/fuzzers/libfuzzer/src/lib.rs +++ b/fuzzers/libfuzzer/src/lib.rs @@ -2,8 +2,6 @@ extern crate alloc; -use alloc::boxed::Box; - #[cfg(feature = "std")] use std::io::stderr;