fix Ptr serialize bug
This commit is contained in:
parent
08a60aa950
commit
2b271aa5aa
@ -1127,6 +1127,7 @@ impl LlmpClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
@ -1174,3 +1175,4 @@ mod tests {
|
|||||||
assert_eq!(broker.llmp_clients.len(), 2);
|
assert_eq!(broker.llmp_clients.len(), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
@ -317,7 +317,7 @@ where
|
|||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
stats.client_stats_mut()[0].corpus_size = *corpus_size as u64;
|
stats.client_stats_mut()[0].corpus_size = *corpus_size as u64;
|
||||||
println!("[NEW] corpus: {}", stats.corpus_size());
|
stats.show(self.name().to_string());
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
LoggerEvent::UpdateStats {
|
LoggerEvent::UpdateStats {
|
||||||
@ -327,12 +327,7 @@ where
|
|||||||
} => {
|
} => {
|
||||||
// TODO: The stats buffer should be added on client add.
|
// TODO: The stats buffer should be added on client add.
|
||||||
stats.client_stats_mut()[0].executions = *executions as u64;
|
stats.client_stats_mut()[0].executions = *executions as u64;
|
||||||
println!(
|
stats.show(self.name().to_string());
|
||||||
"[UPDATE] corpus: {} execs: {} execs/s: {}",
|
|
||||||
stats.corpus_size(),
|
|
||||||
stats.total_execs(),
|
|
||||||
stats.execs_per_sec()
|
|
||||||
);
|
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
LoggerEvent::Crash { input: _ } => {
|
LoggerEvent::Crash { input: _ } => {
|
||||||
@ -590,7 +585,7 @@ where
|
|||||||
} => {
|
} => {
|
||||||
let client = stats.client_stats_mut_for(self.sender_id);
|
let client = stats.client_stats_mut_for(self.sender_id);
|
||||||
client.corpus_size = *corpus_size as u64;
|
client.corpus_size = *corpus_size as u64;
|
||||||
println!("[NEW] corpus: {}", stats.corpus_size());
|
stats.show(self.name().to_string() + " #" + &self.sender_id.to_string());
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
LLMPEventKind::UpdateStats {
|
LLMPEventKind::UpdateStats {
|
||||||
@ -601,12 +596,7 @@ where
|
|||||||
// TODO: The stats buffer should be added on client add.
|
// TODO: The stats buffer should be added on client add.
|
||||||
let client = stats.client_stats_mut_for(self.sender_id);
|
let client = stats.client_stats_mut_for(self.sender_id);
|
||||||
client.executions = *executions as u64;
|
client.executions = *executions as u64;
|
||||||
println!(
|
stats.show(self.name().to_string() + " #" + &self.sender_id.to_string());
|
||||||
"[UPDATE] corpus: {} execs: {} execs/s: {}",
|
|
||||||
stats.corpus_size(),
|
|
||||||
stats.total_execs(),
|
|
||||||
stats.execs_per_sec()
|
|
||||||
);
|
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
LLMPEventKind::Crash { input: _ } => {
|
LLMPEventKind::Crash { input: _ } => {
|
||||||
@ -623,7 +613,7 @@ where
|
|||||||
println!("[LOG {}]: {}", severity_level, message);
|
println!("[LOG {}]: {}", severity_level, message);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
_ => Ok(BrokerEventResult::Forward),
|
//_ => Ok(BrokerEventResult::Forward),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,7 +881,6 @@ mod tests {
|
|||||||
let obv = StdMapObserver::new("test", unsafe { &mut MAP });
|
let obv = StdMapObserver::new("test", unsafe { &mut MAP });
|
||||||
let map = tuple_list!(obv);
|
let map = tuple_list!(obv);
|
||||||
let observers_buf = map.serialize().unwrap();
|
let observers_buf = map.serialize().unwrap();
|
||||||
// test_event_mgr.serialize_observers(&map).unwrap();
|
|
||||||
|
|
||||||
let i = BytesInput::new(vec![0]);
|
let i = BytesInput::new(vec![0]);
|
||||||
let e = LLMPEvent {
|
let e = LLMPEvent {
|
||||||
|
@ -469,9 +469,9 @@ impl<'a, T: 'a + ?Sized + serde::Serialize> serde::Serialize for Ptr<'a, T> {
|
|||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
{
|
{
|
||||||
match *self {
|
match self {
|
||||||
Ptr::Ref(ref r) => se.serialize_some(r),
|
Ptr::Ref(r) => r.serialize(se),
|
||||||
Ptr::Owned(ref b) => se.serialize_some(b.as_ref()),
|
Ptr::Owned(b) => b.serialize(se),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,9 +507,9 @@ impl<'a, T: 'a + ?Sized + serde::Serialize> serde::Serialize for PtrMut<'a, T> {
|
|||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
{
|
{
|
||||||
match *self {
|
match self {
|
||||||
PtrMut::Ref(ref r) => se.serialize_some(r),
|
PtrMut::Ref(r) => r.serialize(se),
|
||||||
PtrMut::Owned(ref b) => se.serialize_some(b.as_ref()),
|
PtrMut::Owned(b) => b.serialize(se),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -552,9 +552,9 @@ impl<'a, T: 'a + Sized + serde::Serialize> serde::Serialize for Slice<'a, T> {
|
|||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
{
|
{
|
||||||
match *self {
|
match self {
|
||||||
Slice::Ref(ref r) => se.serialize_some(r),
|
Slice::Ref(r) => r.serialize(se),
|
||||||
Slice::Owned(ref b) => se.serialize_some(b.as_slice()),
|
Slice::Owned(b) => b.serialize(se),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -590,9 +590,9 @@ impl<'a, T: 'a + Sized + serde::Serialize> serde::Serialize for SliceMut<'a, T>
|
|||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
{
|
{
|
||||||
match *self {
|
match self {
|
||||||
SliceMut::Ref(ref r) => se.serialize_some(r),
|
SliceMut::Ref(r) => r.serialize(se),
|
||||||
SliceMut::Owned(ref b) => se.serialize_some(b.as_slice()),
|
SliceMut::Owned(b) => b.serialize(se),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,12 @@
|
|||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
use std::io::stderr;
|
|
||||||
|
|
||||||
use afl::corpus::InMemoryCorpus;
|
use afl::corpus::InMemoryCorpus;
|
||||||
use afl::engines::Engine;
|
use afl::engines::Engine;
|
||||||
use afl::engines::Fuzzer;
|
use afl::engines::Fuzzer;
|
||||||
use afl::engines::State;
|
use afl::engines::State;
|
||||||
use afl::engines::StdFuzzer;
|
use afl::engines::StdFuzzer;
|
||||||
use afl::events::LlmpEventManager;
|
use afl::events::{SimpleStats, LlmpEventManager};
|
||||||
use afl::executors::inmemory::InMemoryExecutor;
|
use afl::executors::inmemory::InMemoryExecutor;
|
||||||
use afl::executors::{Executor, ExitKind};
|
use afl::executors::{Executor, ExitKind};
|
||||||
use afl::feedbacks::MaxMapFeedback;
|
use afl::feedbacks::MaxMapFeedback;
|
||||||
@ -22,7 +19,6 @@ use afl::stages::mutational::StdMutationalStage;
|
|||||||
use afl::tuples::tuple_list;
|
use afl::tuples::tuple_list;
|
||||||
use afl::utils::StdRand;
|
use afl::utils::StdRand;
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
/// int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
/// int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
|
||||||
fn LLVMFuzzerTestOneInput(data: *const u8, size: usize) -> i32;
|
fn LLVMFuzzerTestOneInput(data: *const u8, size: usize) -> i32;
|
||||||
@ -48,10 +44,8 @@ pub extern "C" fn afl_libfuzzer_main() {
|
|||||||
let mut corpus = InMemoryCorpus::new();
|
let mut corpus = InMemoryCorpus::new();
|
||||||
let mut generator = RandPrintablesGenerator::new(32);
|
let mut generator = RandPrintablesGenerator::new(32);
|
||||||
|
|
||||||
// TODO: No_std event manager
|
let stats = SimpleStats::new(|s| println!("{}", s));
|
||||||
#[cfg(feature = "std")]
|
let mut mgr = LlmpEventManager::new_on_port(1337, stats).unwrap();
|
||||||
//let mut events = LoggerEventManager::new(stderr());
|
|
||||||
let mut mgr = LlmpEventManager::new_on_port(1337, stderr()).unwrap();
|
|
||||||
if mgr.is_broker() {
|
if mgr.is_broker() {
|
||||||
println!("Doing broker things.");
|
println!("Doing broker things.");
|
||||||
mgr.broker_loop().unwrap();
|
mgr.broker_loop().unwrap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user