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:
van Hauser 2023-12-17 12:19:15 +01:00 committed by GitHub
parent ef8ebd5239
commit 63e1523358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 6 deletions

View File

@ -79,7 +79,9 @@ impl<'a> Harness<'a> {
self.emu
.write_function_argument(CallingConvention::Cdecl, 1, len)
.map_err(|e| Error::unknown(format!("Failed to write argument 1: {e:}")))?;
unsafe { self.emu.run() };
unsafe {
let _ = self.emu.run();
};
Ok(())
}
}

View File

@ -186,7 +186,7 @@ impl<'a> Instance<'a> {
let mut executor = TimeoutExecutor::new(executor, self.options.timeout);
// 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));
self.fuzz(&mut state, &mut fuzzer, &mut executor, &mut stages)

View File

@ -18,10 +18,10 @@ use crate::version::Version;
long_about = "Binary fuzzer using QEMU binary instrumentation"
)]
pub struct FuzzerOptions {
#[arg(long, help = "Input directory")]
#[arg(short, long, help = "Input directory")]
pub input: String,
#[arg(long, help = "Output directory")]
#[arg(short, long, help = "Output directory")]
pub output: String,
#[arg(long, help = "Tokens file")]

View File

@ -12,6 +12,14 @@ pub struct 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>
where
P: AsRef<Path>,

View File

@ -982,7 +982,7 @@ impl Emulator {
}
#[must_use]
pub(crate) fn new_empty() -> Emulator {
pub fn new_empty() -> Emulator {
Emulator { _private: () }
}

View File

@ -493,7 +493,7 @@ where
QT: QemuHelperTuple<S>,
{
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(
Hook::Empty,
Hook::Function(trace_write1_snapshot::<QT, S>),