small fixes and enhancements (#1731)
* nits * first steps * different approach * fixes * remove temps * remove temp --------- Co-authored-by: Dongjia "toka" Zhang <tokazerkje@outlook.com>
This commit is contained in:
parent
ef8ebd5239
commit
63e1523358
@ -79,7 +79,9 @@ impl<'a> Harness<'a> {
|
|||||||
self.emu
|
self.emu
|
||||||
.write_function_argument(CallingConvention::Cdecl, 1, len)
|
.write_function_argument(CallingConvention::Cdecl, 1, len)
|
||||||
.map_err(|e| Error::unknown(format!("Failed to write argument 1: {e:}")))?;
|
.map_err(|e| Error::unknown(format!("Failed to write argument 1: {e:}")))?;
|
||||||
unsafe { self.emu.run() };
|
unsafe {
|
||||||
|
let _ = self.emu.run();
|
||||||
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ impl<'a> Instance<'a> {
|
|||||||
let mut executor = TimeoutExecutor::new(executor, self.options.timeout);
|
let mut executor = TimeoutExecutor::new(executor, self.options.timeout);
|
||||||
|
|
||||||
// Setup an havoc mutator with a mutational stage
|
// Setup an havoc mutator with a mutational stage
|
||||||
let mutator = StdScheduledMutator::new(havoc_mutations());
|
let mutator = StdScheduledMutator::new(havoc_mutations().merge(tokens_mutations()));
|
||||||
let mut stages = tuple_list!(StdMutationalStage::new(mutator));
|
let mut stages = tuple_list!(StdMutationalStage::new(mutator));
|
||||||
|
|
||||||
self.fuzz(&mut state, &mut fuzzer, &mut executor, &mut stages)
|
self.fuzz(&mut state, &mut fuzzer, &mut executor, &mut stages)
|
||||||
|
@ -18,10 +18,10 @@ use crate::version::Version;
|
|||||||
long_about = "Binary fuzzer using QEMU binary instrumentation"
|
long_about = "Binary fuzzer using QEMU binary instrumentation"
|
||||||
)]
|
)]
|
||||||
pub struct FuzzerOptions {
|
pub struct FuzzerOptions {
|
||||||
#[arg(long, help = "Input directory")]
|
#[arg(short, long, help = "Input directory")]
|
||||||
pub input: String,
|
pub input: String,
|
||||||
|
|
||||||
#[arg(long, help = "Output directory")]
|
#[arg(short, long, help = "Output directory")]
|
||||||
pub output: String,
|
pub output: String,
|
||||||
|
|
||||||
#[arg(long, help = "Tokens file")]
|
#[arg(long, help = "Tokens file")]
|
||||||
|
@ -12,6 +12,14 @@ pub struct EasyElf<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> EasyElf<'a> {
|
impl<'a> EasyElf<'a> {
|
||||||
|
pub fn get_needed(&self) -> Result<Vec<&'a str>, Error> {
|
||||||
|
let mut v: Vec<&str> = Vec::new();
|
||||||
|
for dyn_lib in &self.elf.libraries {
|
||||||
|
v.push(dyn_lib);
|
||||||
|
}
|
||||||
|
Ok(v)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn from_file<P>(path: P, buffer: &'a mut Vec<u8>) -> Result<Self, Error>
|
pub fn from_file<P>(path: P, buffer: &'a mut Vec<u8>) -> Result<Self, Error>
|
||||||
where
|
where
|
||||||
P: AsRef<Path>,
|
P: AsRef<Path>,
|
||||||
|
@ -982,7 +982,7 @@ impl Emulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub(crate) fn new_empty() -> Emulator {
|
pub fn new_empty() -> Emulator {
|
||||||
Emulator { _private: () }
|
Emulator { _private: () }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ where
|
|||||||
QT: QemuHelperTuple<S>,
|
QT: QemuHelperTuple<S>,
|
||||||
{
|
{
|
||||||
if hooks.match_helper::<QemuAsanHelper>().is_none() {
|
if hooks.match_helper::<QemuAsanHelper>().is_none() {
|
||||||
// The ASan helper, if present, will call the tracer hook for the snpahsot helper as opt
|
// The ASan helper, if present, will call the tracer hook for the snapshot helper as opt
|
||||||
hooks.writes(
|
hooks.writes(
|
||||||
Hook::Empty,
|
Hook::Empty,
|
||||||
Hook::Function(trace_write1_snapshot::<QT, S>),
|
Hook::Function(trace_write1_snapshot::<QT, S>),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user