testcases fixed, no_std fixes
This commit is contained in:
parent
705196fe32
commit
0134b74a39
@ -32,11 +32,11 @@ where
|
||||
|
||||
pub struct MinimizerCorpusScheduler<C, CS, F, I, S>
|
||||
where
|
||||
CS: CorpusScheduler<I, S>,
|
||||
F: FavFactor<I>,
|
||||
I: Input,
|
||||
S: HasCorpus<C, I>,
|
||||
C: Corpus<I>
|
||||
CS: CorpusScheduler<I, S>,
|
||||
F: FavFactor<I>,
|
||||
I: Input,
|
||||
S: HasCorpus<C, I>,
|
||||
C: Corpus<I>,
|
||||
{
|
||||
base: CS,
|
||||
phantom: PhantomData<(C, F, I, S)>,
|
||||
@ -44,11 +44,11 @@ C: Corpus<I>
|
||||
|
||||
impl<C, CS, F, I, S> CorpusScheduler<I, S> for MinimizerCorpusScheduler<C, CS, F, I, S>
|
||||
where
|
||||
CS: CorpusScheduler<I, S>,
|
||||
F: FavFactor<I>,
|
||||
I: Input,
|
||||
S: HasCorpus<C, I>,
|
||||
C: Corpus<I>
|
||||
CS: CorpusScheduler<I, S>,
|
||||
F: FavFactor<I>,
|
||||
I: Input,
|
||||
S: HasCorpus<C, I>,
|
||||
C: Corpus<I>,
|
||||
{
|
||||
/// 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>,
|
||||
I: Input,
|
||||
S: HasCorpus<C, I>,
|
||||
C: Corpus<I>
|
||||
C: Corpus<I>,
|
||||
{
|
||||
/*pub fn update_score(&self, state: &mut S, idx: usize) -> Result<(), Error> {
|
||||
let entry = state.corpus().get(idx)?.borrow_mut();
|
||||
|
@ -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,
|
||||
|
@ -255,7 +255,7 @@ where
|
||||
fn handle_in_client<E, OT>(
|
||||
&mut self,
|
||||
state: &mut S,
|
||||
sender_id: u32,
|
||||
_sender_id: u32,
|
||||
event: Event<I>,
|
||||
_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
|
||||
|
@ -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},
|
||||
|
@ -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::<u32>) =
|
||||
let o: tuple_list_type!(StdMapObserver::<u32>) =
|
||||
postcard::from_bytes(&observers_buf).unwrap();
|
||||
let test_observer = o.match_name_type::<StdMapObserver<u32>>("test").unwrap();
|
||||
assert_eq!("test", test_observer.name());
|
||||
assert_eq!("test", o.0.name());
|
||||
}
|
||||
_ => panic!("mistmatch"),
|
||||
};
|
||||
|
@ -53,14 +53,19 @@ where
|
||||
OT: ObserversTuple,
|
||||
{
|
||||
#[inline]
|
||||
fn pre_exec<EM, S>(&mut self, state: &mut S, event_mgr: &mut EM, input: &I) -> Result<(), Error>
|
||||
fn pre_exec<EM, S>(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_event_mgr: &mut EM,
|
||||
_input: &I,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
EM: EventManager<I, S>,
|
||||
{
|
||||
#[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(())
|
||||
}
|
||||
|
@ -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<P>(&self, _path: P) -> Result<(), Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
Err(Error::NotImplemented("Not suppored in no_std".into()))
|
||||
fn to_file<P>(&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<P>(_path: P) -> Result<Self, Error>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
Err(Error::NotImplemented("Not suppored in no_std".into()))
|
||||
fn from_file<P>(_path: P) -> Result<Self, Error> {
|
||||
Err(Error::NotImplemented("Not supprted in no_std".into()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ Welcome to libAFL
|
||||
extern crate alloc;
|
||||
#[macro_use]
|
||||
extern crate static_assertions;
|
||||
#[cfg(feature = "std")]
|
||||
#[macro_use]
|
||||
extern crate ctor;
|
||||
|
||||
|
@ -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};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user