parent
92db678995
commit
deb76555b7
@ -175,7 +175,7 @@ pub trait Corpus: Sized {
|
||||
fn nth(&self, nth: usize) -> CorpusId {
|
||||
self.ids()
|
||||
.nth(nth)
|
||||
.expect("Failed to get the {nth} CorpusId")
|
||||
.unwrap_or_else(|| panic!("Failed to get the {nth} CorpusId"))
|
||||
}
|
||||
|
||||
/// Get the nth corpus id; considers both enabled and disabled testcases
|
||||
|
@ -417,7 +417,7 @@ where
|
||||
+ EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>
|
||||
+ Evaluator<E, Self, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
println!("Got event in client: {} from {:?}", event.name(), client_id);
|
||||
log::trace!("Got event in client: {} from {client_id:?}", event.name());
|
||||
if !self.hooks.pre_exec_all(state, client_id, &event)? {
|
||||
return Ok(());
|
||||
}
|
||||
@ -565,7 +565,7 @@ where
|
||||
#[cfg(not(feature = "llmp_compression"))]
|
||||
{
|
||||
self.llmp
|
||||
.send_buf(LLMP_TAG_EVENT_TO_BOTH, &self.event_buffer[..written_len]);
|
||||
.send_buf(LLMP_TAG_EVENT_TO_BOTH, &self.event_buffer[..written_len])?;
|
||||
}
|
||||
|
||||
self.last_sent = current_time();
|
||||
|
@ -353,7 +353,7 @@ impl<I, S> MutatorsTuple<I, S> for Vec<Box<dyn Mutator<I, S>>> {
|
||||
) -> Result<MutationResult, Error> {
|
||||
let mutator = self
|
||||
.get_mut(index.0)
|
||||
.ok_or_else(|| Error::key_not_found("Mutator with id {index:?} not found."))?;
|
||||
.ok_or_else(|| Error::key_not_found(format!("Mutator with id {index:?} not found.")))?;
|
||||
mutator.mutate(state, input)
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ impl<I, S> MutatorsTuple<I, S> for Vec<Box<dyn Mutator<I, S>>> {
|
||||
) -> Result<(), Error> {
|
||||
let mutator = self
|
||||
.get_mut(index)
|
||||
.ok_or_else(|| Error::key_not_found("Mutator with id {index:?} not found."))?;
|
||||
.ok_or_else(|| Error::key_not_found(format!("Mutator with id {index:?} not found.")))?;
|
||||
mutator.post_exec(state, new_corpus_id)
|
||||
}
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ impl AFLppRedQueen {
|
||||
if buf_16 == pattern as u16 && another_buf_16 == another_pattern as u16 {
|
||||
let mut cloned = buf.to_vec();
|
||||
cloned[buf_idx + 1] = (repl & 0xff) as u8;
|
||||
cloned[buf_idx] = (repl >> 8 & 0xff) as u8;
|
||||
cloned[buf_idx] = ((repl >> 8) & 0xff) as u8;
|
||||
vec.push(cloned);
|
||||
return Ok(true);
|
||||
}
|
||||
@ -1074,9 +1074,9 @@ impl AFLppRedQueen {
|
||||
if buf_32 == pattern as u32 && another_buf_32 == another_pattern as u32 {
|
||||
let mut cloned = buf.to_vec();
|
||||
cloned[buf_idx + 3] = (repl & 0xff) as u8;
|
||||
cloned[buf_idx + 2] = (repl >> 8 & 0xff) as u8;
|
||||
cloned[buf_idx + 1] = (repl >> 16 & 0xff) as u8;
|
||||
cloned[buf_idx] = (repl >> 24 & 0xff) as u8;
|
||||
cloned[buf_idx + 2] = ((repl >> 8) & 0xff) as u8;
|
||||
cloned[buf_idx + 1] = ((repl >> 16) & 0xff) as u8;
|
||||
cloned[buf_idx] = ((repl >> 24) & 0xff) as u8;
|
||||
vec.push(cloned);
|
||||
|
||||
return Ok(true);
|
||||
@ -1093,13 +1093,13 @@ impl AFLppRedQueen {
|
||||
let mut cloned = buf.to_vec();
|
||||
|
||||
cloned[buf_idx + 7] = (repl & 0xff) as u8;
|
||||
cloned[buf_idx + 6] = (repl >> 8 & 0xff) as u8;
|
||||
cloned[buf_idx + 5] = (repl >> 16 & 0xff) as u8;
|
||||
cloned[buf_idx + 4] = (repl >> 24 & 0xff) as u8;
|
||||
cloned[buf_idx + 3] = (repl >> 32 & 0xff) as u8;
|
||||
cloned[buf_idx + 2] = (repl >> 32 & 0xff) as u8;
|
||||
cloned[buf_idx + 1] = (repl >> 40 & 0xff) as u8;
|
||||
cloned[buf_idx] = (repl >> 48 & 0xff) as u8;
|
||||
cloned[buf_idx + 6] = ((repl >> 8) & 0xff) as u8;
|
||||
cloned[buf_idx + 5] = ((repl >> 16) & 0xff) as u8;
|
||||
cloned[buf_idx + 4] = ((repl >> 24) & 0xff) as u8;
|
||||
cloned[buf_idx + 3] = ((repl >> 32) & 0xff) as u8;
|
||||
cloned[buf_idx + 2] = ((repl >> 32) & 0xff) as u8;
|
||||
cloned[buf_idx + 1] = ((repl >> 40) & 0xff) as u8;
|
||||
cloned[buf_idx] = ((repl >> 48) & 0xff) as u8;
|
||||
|
||||
vec.push(cloned);
|
||||
return Ok(true);
|
||||
|
@ -239,9 +239,10 @@ impl FridaInstrumentationHelperBuilder {
|
||||
let name = path
|
||||
.file_name()
|
||||
.and_then(|name| name.to_str())
|
||||
.expect("Failed to get script file name from path: {path:}");
|
||||
.unwrap_or_else(|| panic!("Failed to get script file name from path: {path:?}"));
|
||||
let script_prefix = include_str!("script.js");
|
||||
let file_contents = read_to_string(path).expect("Failed to read script: {path:}");
|
||||
let file_contents = read_to_string(path)
|
||||
.unwrap_or_else(|err| panic!("Failed to read script {path:?}: {err:?}"));
|
||||
let payload = script_prefix.to_string() + &file_contents;
|
||||
let gum = Gum::obtain();
|
||||
let backend = match backend {
|
||||
|
@ -182,13 +182,13 @@ where
|
||||
.push(Box::pin((InstructionHookId::invalid(), fat)));
|
||||
|
||||
unsafe {
|
||||
let hook_state = &mut self
|
||||
let hook_state = &raw mut self
|
||||
.instruction_hooks
|
||||
.last_mut()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.get_unchecked_mut()
|
||||
.1 as *mut FatPtr;
|
||||
.1;
|
||||
|
||||
let id = self.qemu_hooks.add_instruction_hooks(
|
||||
&mut *hook_state,
|
||||
@ -656,13 +656,13 @@ where
|
||||
self.backdoor_hooks
|
||||
.push(Box::pin((BackdoorHookId::invalid(), fat)));
|
||||
|
||||
let hook_state = &mut self
|
||||
let hook_state = &raw mut self
|
||||
.backdoor_hooks
|
||||
.last_mut()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.get_unchecked_mut()
|
||||
.1 as *mut FatPtr;
|
||||
.1;
|
||||
|
||||
let id = self
|
||||
.qemu_hooks
|
||||
@ -739,13 +739,13 @@ where
|
||||
self.new_thread_hooks
|
||||
.push(Box::pin((NewThreadHookId::invalid(), fat)));
|
||||
|
||||
let hook_state = &mut self
|
||||
let hook_state = &raw mut self
|
||||
.new_thread_hooks
|
||||
.last_mut()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.get_unchecked_mut()
|
||||
.1 as *mut FatPtr;
|
||||
.1;
|
||||
|
||||
let id = self
|
||||
.qemu_hooks
|
||||
@ -797,13 +797,13 @@ where
|
||||
self.pre_syscall_hooks
|
||||
.push(Box::pin((PreSyscallHookId::invalid(), fat)));
|
||||
|
||||
let hook_state = &mut self
|
||||
let hook_state = &raw mut self
|
||||
.pre_syscall_hooks
|
||||
.last_mut()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.get_unchecked_mut()
|
||||
.1 as *mut FatPtr;
|
||||
.1;
|
||||
|
||||
let id = self
|
||||
.qemu_hooks
|
||||
@ -848,13 +848,13 @@ where
|
||||
self.post_syscall_hooks
|
||||
.push(Box::pin((PostSyscallHookId::invalid(), fat)));
|
||||
|
||||
let hooks_state = &mut self
|
||||
let hooks_state = &raw mut self
|
||||
.post_syscall_hooks
|
||||
.last_mut()
|
||||
.unwrap()
|
||||
.as_mut()
|
||||
.get_unchecked_mut()
|
||||
.1 as *mut FatPtr;
|
||||
.1;
|
||||
|
||||
let id = self.qemu_hooks.add_post_syscall_hook(
|
||||
&mut *hooks_state,
|
||||
|
@ -286,7 +286,7 @@ pub mod pybind {
|
||||
a6: u64,
|
||||
a7: u64,
|
||||
) -> SyscallHookResult {
|
||||
unsafe { PY_SYSCALL_HOOK.as_ref() }.map_or_else(
|
||||
unsafe { &*(&raw const PY_SYSCALL_HOOK).as_ref() }.map_or_else(
|
||||
|| SyscallHookResult::new(None),
|
||||
|obj| {
|
||||
let args = (sys_num, a0, a1, a2, a3, a4, a5, a6, a7);
|
||||
|
Loading…
x
Reference in New Issue
Block a user