splice in libfuzzer clone
This commit is contained in:
parent
6c7615a7b9
commit
408f752ed7
@ -8,7 +8,7 @@ use afl::executors::inmemory::InMemoryExecutor;
|
|||||||
use afl::executors::{Executor, ExitKind};
|
use afl::executors::{Executor, ExitKind};
|
||||||
use afl::feedbacks::{create_history_map, MaxMapFeedback};
|
use afl::feedbacks::{create_history_map, MaxMapFeedback};
|
||||||
use afl::inputs::bytes::BytesInput;
|
use afl::inputs::bytes::BytesInput;
|
||||||
use afl::mutators::scheduled::{mutation_bitflip, ComposedByMutations, DefaultScheduledMutator};
|
use afl::mutators::scheduled::HavocBytesMutator;
|
||||||
use afl::observers::DefaultMapObserver;
|
use afl::observers::DefaultMapObserver;
|
||||||
use afl::stages::mutational::DefaultMutationalStage;
|
use afl::stages::mutational::DefaultMutationalStage;
|
||||||
use afl::utils::DefaultRand;
|
use afl::utils::DefaultRand;
|
||||||
@ -53,13 +53,10 @@ pub extern "C" fn afl_libfuzzer_main() {
|
|||||||
state.add_feedback(Box::new(edges_feedback));
|
state.add_feedback(Box::new(edges_feedback));
|
||||||
|
|
||||||
let mut engine = DefaultEngine::new();
|
let mut engine = DefaultEngine::new();
|
||||||
let mut mutator = DefaultScheduledMutator::new(&rand);
|
let mutator = HavocBytesMutator::new_default(&rand);
|
||||||
mutator.add_mutation(mutation_bitflip);
|
|
||||||
let stage = DefaultMutationalStage::new(&rand, mutator);
|
let stage = DefaultMutationalStage::new(&rand, mutator);
|
||||||
engine.add_stage(Box::new(stage));
|
engine.add_stage(Box::new(stage));
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
for i in 0..1000 {
|
for i in 0..1000 {
|
||||||
println!("Fuzzer corpus iteration #{}", i);
|
println!("Fuzzer corpus iteration #{}", i);
|
||||||
engine
|
engine
|
||||||
|
10
fuzzers/libfuzzer/test.sh
Executable file
10
fuzzers/libfuzzer/test.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cargo build --release
|
||||||
|
make -C runtime
|
||||||
|
|
||||||
|
./compiler test/test.c -o test_fuzz
|
||||||
|
|
||||||
|
./test_fuzz
|
||||||
|
|
||||||
|
rm ./test_fuzz
|
@ -97,6 +97,8 @@ pub mod unix_signals {
|
|||||||
let _ = stdout().flush();
|
let _ = stdout().flush();
|
||||||
|
|
||||||
// TODO: LLMP
|
// TODO: LLMP
|
||||||
|
|
||||||
|
std::process::exit(139);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub extern "C" fn libaflrs_executor_inmem_handle_timeout<I>(
|
pub extern "C" fn libaflrs_executor_inmem_handle_timeout<I>(
|
||||||
|
@ -165,7 +165,7 @@ where
|
|||||||
M: HasRand,
|
M: HasRand,
|
||||||
I: Input + HasBytesVec,
|
I: Input + HasBytesVec,
|
||||||
{
|
{
|
||||||
let bit = mutator.rand_below(input.bytes().len() as u64) as usize;
|
let bit = mutator.rand_below((input.bytes().len() * 8) as u64) as usize;
|
||||||
input.bytes_mut()[bit >> 3] ^= (128 >> (bit & 7)) as u8;
|
input.bytes_mut()[bit >> 3] ^= (128 >> (bit & 7)) as u8;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -313,6 +313,7 @@ where
|
|||||||
pub fn new_default(rand: &Rc<RefCell<R>>) -> Self {
|
pub fn new_default(rand: &Rc<RefCell<R>>) -> Self {
|
||||||
let mut scheduled = DefaultScheduledMutator::<C, I, R>::new(rand);
|
let mut scheduled = DefaultScheduledMutator::<C, I, R>::new(rand);
|
||||||
scheduled.add_mutation(mutation_bitflip);
|
scheduled.add_mutation(mutation_bitflip);
|
||||||
|
scheduled.add_mutation(mutation_splice);
|
||||||
HavocBytesMutator {
|
HavocBytesMutator {
|
||||||
scheduled: scheduled,
|
scheduled: scheduled,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user