fuzzes again

This commit is contained in:
Dominik Maier 2020-12-13 23:56:44 +01:00
parent afce4f3330
commit 52e1f52e1d
3 changed files with 14 additions and 10 deletions

View File

@ -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<I>
where
@ -232,6 +232,13 @@ where
/// Broker fun
fn handle_in_broker(&mut self, event: &Event<I>) -> Result<BrokerEventResult, AflError> {
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<I>,
{
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<ClientStats>,

View File

@ -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<P>(&self, path: P) -> Result<(), AflError>

View File

@ -2,8 +2,6 @@
extern crate alloc;
use alloc::boxed::Box;
#[cfg(feature = "std")]
use std::io::stderr;