parent
796ce20cd8
commit
dd0bcba103
@ -2,6 +2,7 @@ use std::borrow::Cow;
|
||||
|
||||
use lain::traits::Mutatable;
|
||||
use libafl::{
|
||||
corpus::CorpusId,
|
||||
mutators::{MutationResult, Mutator},
|
||||
state::HasRand,
|
||||
Error,
|
||||
@ -27,6 +28,11 @@ where
|
||||
input.mutate(&mut self.inner, None);
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for LainMutator {
|
||||
|
@ -2,6 +2,7 @@ use core::num::NonZeroUsize;
|
||||
use std::{borrow::Cow, hash::Hash};
|
||||
|
||||
use libafl::{
|
||||
corpus::CorpusId,
|
||||
generators::{Generator, RandBytesGenerator},
|
||||
inputs::{BytesInput, HasTargetBytes, Input},
|
||||
mutators::{MutationResult, Mutator},
|
||||
@ -125,6 +126,10 @@ where
|
||||
};
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<G> Named for ToggleOptionalByteArrayMutator<G> {
|
||||
@ -141,6 +146,11 @@ impl<S> Mutator<CustomInput, S> for ToggleBooleanMutator {
|
||||
input.boolean = !input.boolean;
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for ToggleBooleanMutator {
|
||||
|
@ -281,7 +281,6 @@ pub struct TuiContext {
|
||||
|
||||
pub total_map_density: String,
|
||||
pub total_solutions: u64,
|
||||
pub total_cycles_done: u64,
|
||||
pub total_corpus_count: u64,
|
||||
|
||||
pub total_process_timing: ProcessTiming,
|
||||
@ -310,7 +309,6 @@ impl TuiContext {
|
||||
|
||||
total_map_density: "0%".to_string(),
|
||||
total_solutions: 0,
|
||||
total_cycles_done: 0,
|
||||
total_corpus_count: 0,
|
||||
total_item_geometry: ItemGeometry::new(),
|
||||
total_process_timing: ProcessTiming::new(),
|
||||
@ -374,7 +372,6 @@ impl Monitor for TuiMonitor {
|
||||
edges_total,
|
||||
}| format!("{}%", edges_hit * 100 / edges_total),
|
||||
);
|
||||
ctx.total_cycles_done = 0;
|
||||
ctx.total_item_geometry = client_stats_manager.item_geometry();
|
||||
}
|
||||
|
||||
|
@ -602,8 +602,6 @@ impl TuiUi {
|
||||
Row::new(vec![
|
||||
Cell::from(Span::raw("solutions")),
|
||||
Cell::from(Span::raw(format_big_number(app.total_solutions))),
|
||||
Cell::from(Span::raw("cycle done")),
|
||||
Cell::from(Span::raw(format_big_number(app.total_cycles_done))),
|
||||
Cell::from(Span::raw("corpus count")),
|
||||
Cell::from(Span::raw(format_big_number(app.total_corpus_count))),
|
||||
]),
|
||||
|
@ -36,6 +36,14 @@ impl<S: HasRand> Mutator<EncodedInput, S> for EncodedRandMutator {
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedRandMutator {
|
||||
@ -67,6 +75,14 @@ impl<S: HasRand> Mutator<EncodedInput, S> for EncodedIncMutator {
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedIncMutator {
|
||||
@ -98,6 +114,14 @@ impl<S: HasRand> Mutator<EncodedInput, S> for EncodedDecMutator {
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedDecMutator {
|
||||
@ -133,6 +157,14 @@ impl<S: HasRand> Mutator<EncodedInput, S> for EncodedAddMutator {
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedAddMutator {
|
||||
@ -174,6 +206,14 @@ impl<S: HasRand> Mutator<EncodedInput, S> for EncodedDeleteMutator {
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedDeleteMutator {
|
||||
@ -241,6 +281,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedInsertCopyMutator {
|
||||
@ -289,6 +337,14 @@ impl<S: HasRand> Mutator<EncodedInput, S> for EncodedCopyMutator {
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedCopyMutator {
|
||||
@ -372,6 +428,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedCrossoverInsertMutator {
|
||||
@ -445,6 +509,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for EncodedCrossoverReplaceMutator {
|
||||
|
@ -56,6 +56,14 @@ where
|
||||
Ok(MutationResult::Skipped)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> Named for GramatronRandomMutator<'_, S>
|
||||
@ -158,6 +166,14 @@ where
|
||||
},
|
||||
)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for GramatronSpliceMutator {
|
||||
@ -267,6 +283,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for GramatronRecursionMutator {
|
||||
|
@ -139,6 +139,14 @@ where
|
||||
&mut self.gap_indices,
|
||||
)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> Named for GrimoireExtensionMutator<I> {
|
||||
@ -219,6 +227,14 @@ where
|
||||
|
||||
Ok(mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> Named for GrimoireRecursiveReplacementMutator<I> {
|
||||
@ -343,6 +359,14 @@ where
|
||||
|
||||
Ok(mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> Named for GrimoireStringReplacementMutator<I> {
|
||||
@ -410,6 +434,14 @@ where
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> Named for GrimoireRandomDeleteMutator<I> {
|
||||
|
@ -40,6 +40,14 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
state: &mut S,
|
||||
new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
self.inner.post_exec(state, new_corpus_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl<M> Named for MutationChecker<M> {
|
||||
|
@ -60,6 +60,14 @@ where
|
||||
input.append_part(generated);
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<G> Named for GenerateToAppendMutator<G> {
|
||||
@ -88,6 +96,14 @@ where
|
||||
None => Ok(MutationResult::Skipped),
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for RemoveLastEntryMutator {
|
||||
@ -123,6 +139,14 @@ where
|
||||
}
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for RemoveRandomEntryMutator {
|
||||
@ -168,6 +192,14 @@ where
|
||||
input.insert_part(current_idx, (key, part));
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for CrossoverInsertMutator {
|
||||
@ -214,6 +246,14 @@ where
|
||||
input.insert_part(current_idx, (key, part));
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for CrossoverReplaceMutator {
|
||||
|
@ -73,6 +73,14 @@ where
|
||||
fn mutate(&mut self, state: &mut S, input: &mut IO) -> Result<MutationResult, Error> {
|
||||
self.inner.mutate(state, (self.mapper)(input))
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
state: &mut S,
|
||||
new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
self.inner.post_exec(state, new_corpus_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl<M, F> Named for MappingMutator<M, F> {
|
||||
@ -202,6 +210,14 @@ where
|
||||
Some(i) => self.inner.mutate(state, i),
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
state: &mut S,
|
||||
new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
self.inner.post_exec(state, new_corpus_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl<M> Named for OptionalMutator<M>
|
||||
|
@ -111,10 +111,7 @@ pub trait Mutator<I, S>: Named {
|
||||
|
||||
/// Post-process given the outcome of the execution
|
||||
/// `new_corpus_id` will be `Some` if a new [`crate::corpus::Testcase`] was created this execution.
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
/// A mutator that takes input, and returns a vector of mutated inputs.
|
||||
@ -400,6 +397,10 @@ impl<I, S> Mutator<I, S> for NopMutator {
|
||||
fn mutate(&mut self, _state: &mut S, _input: &mut I) -> Result<MutationResult, Error> {
|
||||
Ok(self.result)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for NopMutator {
|
||||
@ -419,6 +420,10 @@ impl<S> Mutator<bool, S> for BoolInvertMutator {
|
||||
*input = !*input;
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BoolInvertMutator {
|
||||
|
@ -255,6 +255,10 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, K, S> Mutator<MultipartInput<I, K>, S> for BytesInputCrossoverReplaceMutator
|
||||
@ -389,4 +393,8 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -141,6 +141,14 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BitFlipMutator {
|
||||
@ -175,6 +183,14 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for ByteFlipMutator {
|
||||
@ -210,6 +226,14 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for ByteIncMutator {
|
||||
@ -245,6 +269,14 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for ByteDecMutator {
|
||||
@ -280,6 +312,14 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for ByteNegMutator {
|
||||
@ -315,6 +355,14 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for ByteRandMutator {
|
||||
@ -376,6 +424,10 @@ macro_rules! add_mutator_impl {
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<crate::corpus::CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for $name {
|
||||
@ -434,6 +486,14 @@ macro_rules! interesting_mutator_impl {
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for $name {
|
||||
@ -482,6 +542,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesDeleteMutator {
|
||||
@ -533,6 +601,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesExpandMutator {
|
||||
@ -601,6 +677,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesInsertMutator {
|
||||
@ -664,6 +748,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesRandInsertMutator {
|
||||
@ -707,6 +799,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesSetMutator {
|
||||
@ -750,6 +850,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesRandSetMutator {
|
||||
@ -799,6 +907,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesCopyMutator {
|
||||
@ -875,6 +991,14 @@ where
|
||||
}
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesInsertCopyMutator {
|
||||
@ -1090,6 +1214,14 @@ where
|
||||
Ok(MutationResult::Skipped)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BytesSwapMutator {
|
||||
@ -1201,6 +1333,14 @@ where
|
||||
other.mutator_bytes(),
|
||||
))
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for CrossoverInsertMutator {
|
||||
@ -1296,6 +1436,14 @@ where
|
||||
other.mutator_bytes(),
|
||||
))
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for CrossoverReplaceMutator {
|
||||
@ -1409,6 +1557,14 @@ where
|
||||
mapped_other_input,
|
||||
))
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<F, I, O> Named for MappedCrossoverInsertMutator<F, I, O> {
|
||||
@ -1495,6 +1651,14 @@ where
|
||||
mapped_other_input,
|
||||
))
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<F, I, O> Named for MappedCrossoverReplaceMutator<F, I, O> {
|
||||
@ -1565,6 +1729,14 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for SpliceMutator {
|
||||
|
@ -62,6 +62,14 @@ impl<S: HasRand> Mutator<NautilusInput, S> for NautilusRandomMutator<'_> {
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for NautilusRandomMutator<'_> {
|
||||
@ -127,6 +135,14 @@ impl<S: HasRand> Mutator<NautilusInput, S> for NautilusRecursionMutator<'_> {
|
||||
}
|
||||
Ok(MutationResult::Skipped)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for NautilusRecursionMutator<'_> {
|
||||
@ -198,6 +214,14 @@ where
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for NautilusSpliceMutator<'_> {
|
||||
|
@ -252,6 +252,14 @@ where
|
||||
input.flip_bit_at(offset);
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for BitFlipMutator {
|
||||
@ -272,6 +280,14 @@ where
|
||||
input.flip_all_bits();
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for NegateMutator {
|
||||
@ -292,6 +308,14 @@ where
|
||||
input.wrapping_inc();
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for IncMutator {
|
||||
@ -312,6 +336,14 @@ where
|
||||
input.wrapping_dec();
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for DecMutator {
|
||||
@ -332,6 +364,14 @@ where
|
||||
input.twos_complement();
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for TwosComplementMutator {
|
||||
@ -354,6 +394,14 @@ where
|
||||
input.randomize(state.rand_mut());
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for RandMutator {
|
||||
@ -382,6 +430,14 @@ where
|
||||
*input = *other_testcase.input().as_ref().unwrap();
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for CrossoverMutator {
|
||||
@ -425,6 +481,14 @@ where
|
||||
*input = mapped_input;
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<F, I> Named for MappedCrossoverMutator<F, I> {
|
||||
|
@ -119,6 +119,10 @@ where
|
||||
fn mutate(&mut self, state: &mut S, input: &mut I) -> Result<MutationResult, Error> {
|
||||
self.scheduled_mutate(state, input)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<MT> ComposedByMutations for SingleChoiceScheduledMutator<MT> {
|
||||
@ -197,6 +201,10 @@ where
|
||||
fn mutate(&mut self, state: &mut S, input: &mut I) -> Result<MutationResult, Error> {
|
||||
self.scheduled_mutate(state, input)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<MT> ComposedByMutations for HavocScheduledMutator<MT> {
|
||||
|
@ -352,6 +352,10 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for TokenInsert {
|
||||
@ -412,6 +416,10 @@ where
|
||||
|
||||
Ok(MutationResult::Mutated)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for TokenReplace {
|
||||
@ -599,6 +607,10 @@ where
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for I2SRandReplace {
|
||||
@ -807,6 +819,10 @@ where
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for I2SRandReplaceBinonly {
|
||||
|
@ -95,6 +95,14 @@ where
|
||||
fn mutate(&mut self, state: &mut S, input: &mut I) -> Result<MutationResult, Error> {
|
||||
self.scheduled_mutate(state, input)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(
|
||||
&mut self,
|
||||
_state: &mut S,
|
||||
_new_corpus_id: Option<crate::corpus::CorpusId>,
|
||||
) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<MT> ComposedByMutations for TuneableScheduledMutator<MT> {
|
||||
|
@ -334,6 +334,10 @@ where
|
||||
|
||||
Ok(MutationResult::Skipped)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Mutator which randomly replaces a randomly selected range of bytes with bytes that preserve the
|
||||
@ -385,6 +389,10 @@ where
|
||||
|
||||
Ok(MutationResult::Skipped)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Mutator which randomly replaces a full category-contiguous region of chars with a random token
|
||||
@ -444,6 +452,10 @@ where
|
||||
|
||||
Ok(MutationResult::Skipped)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Mutator which randomly replaces a full subcategory-contiguous region of chars with a random token
|
||||
@ -503,6 +515,10 @@ where
|
||||
|
||||
Ok(MutationResult::Skipped)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -5,7 +5,7 @@ use alloc::{
|
||||
vec::Vec,
|
||||
};
|
||||
use core::{cell::RefCell, marker::PhantomData, ops::Deref};
|
||||
|
||||
use libafl::corpus::CorpusId;
|
||||
use libafl::{
|
||||
Error,
|
||||
corpus::Corpus,
|
||||
@ -302,6 +302,10 @@ where
|
||||
fn mutate(&mut self, state: &mut S, input: &mut BytesInput) -> Result<MutationResult, Error> {
|
||||
self.scheduled_mutate(state, input)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, state: &mut S, new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
self.mutator.deref().borrow_mut().post_exec(state, new_corpus_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, SM> ScheduledMutator<BytesInput, S> for LLVMCustomMutator<S, SM, false>
|
||||
@ -381,6 +385,10 @@ where
|
||||
fn mutate(&mut self, state: &mut S, input: &mut BytesInput) -> Result<MutationResult, Error> {
|
||||
self.scheduled_mutate(state, input)
|
||||
}
|
||||
#[inline]
|
||||
fn post_exec(&mut self, state: &mut S, new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
|
||||
self.mutator.deref().borrow_mut().post_exec(state, new_corpus_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl<S, SM> ScheduledMutator<BytesInput, S> for LLVMCustomMutator<S, SM, true>
|
||||
|
Loading…
x
Reference in New Issue
Block a user