testcase as arg for perform
This commit is contained in:
parent
4fa50ebfaf
commit
056f5b6689
@ -31,8 +31,9 @@ where
|
||||
}
|
||||
|
||||
fn fuzz_one(&mut self, corpus: &mut C) -> Result<(), AflError> {
|
||||
let testcase = corpus.next()?;
|
||||
for stage in self.stages_mut() {
|
||||
stage.perform(corpus)?;
|
||||
stage.perform(testcase.clone(), corpus)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
pub mod mutational;
|
||||
pub use mutational::DefaultMutationalStage;
|
||||
|
||||
use crate::corpus::testcase::Testcase;
|
||||
use crate::corpus::Corpus;
|
||||
use crate::inputs::Input;
|
||||
use crate::AflError;
|
||||
use alloc::rc::Rc;
|
||||
use core::cell::RefCell;
|
||||
|
||||
pub trait Stage<C, I>
|
||||
where
|
||||
@ -11,5 +14,9 @@ where
|
||||
I: Input,
|
||||
{
|
||||
/// Run the stage
|
||||
fn perform(&mut self, corpus: &mut C) -> Result<(), AflError>;
|
||||
fn perform(
|
||||
&mut self,
|
||||
testcase: Rc<RefCell<Testcase<I>>>,
|
||||
corpus: &mut C,
|
||||
) -> Result<(), AflError>;
|
||||
}
|
||||
|
@ -36,8 +36,11 @@ where
|
||||
}
|
||||
|
||||
/// Runs this (mutational) stage for the given testcase
|
||||
fn perform_mutational(&mut self, corpus: &mut C) -> Result<(), AflError> {
|
||||
let testcase = corpus.next()?;
|
||||
fn perform_mutational(
|
||||
&mut self,
|
||||
testcase: Rc<RefCell<Testcase<I>>>,
|
||||
corpus: &mut C,
|
||||
) -> Result<(), AflError> {
|
||||
let num = self.iterations();
|
||||
let input = testcase.borrow_mut().load_input()?.clone();
|
||||
|
||||
@ -120,8 +123,12 @@ where
|
||||
M: Mutator<C, I, R = R>,
|
||||
E: Executor<I>,
|
||||
{
|
||||
fn perform(&mut self, corpus: &mut C) -> Result<(), AflError> {
|
||||
self.perform_mutational(corpus)
|
||||
fn perform(
|
||||
&mut self,
|
||||
testcase: Rc<RefCell<Testcase<I>>>,
|
||||
corpus: &mut C,
|
||||
) -> Result<(), AflError> {
|
||||
self.perform_mutational(testcase, corpus)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user