Remove useless allocation in colorization stage (#2598)

* do not allocate here

* clippy
This commit is contained in:
Romain Malmain 2024-10-09 17:16:53 +02:00 committed by GitHub
parent 1e4d38d744
commit c03653f7be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -189,20 +189,11 @@ where
// This is the buffer we'll randomly mutate during type_replace
let mut changed = input.clone();
// input will be consumed so clone it
let consumed_input = input.clone();
// First, run orig_input once and get the original hash
// Idea: No need to do this every time
let orig_hash = Self::get_raw_map_hash_run(
fuzzer,
executor,
state,
manager,
consumed_input,
observer_handle,
)?;
let orig_hash =
Self::get_raw_map_hash_run(fuzzer, executor, state, manager, &input, observer_handle)?;
let changed_bytes = changed.bytes_mut();
let input_len = changed_bytes.len();
@ -240,13 +231,12 @@ where
);
}
let consumed_input = input.clone();
let changed_hash = Self::get_raw_map_hash_run(
fuzzer,
executor,
state,
manager,
consumed_input,
&input,
observer_handle,
)?;
@ -333,12 +323,12 @@ where
executor: &mut E,
state: &mut <Self as UsesState>::State,
manager: &mut EM,
input: E::Input,
input: &E::Input,
observer_handle: &Handle<C>,
) -> Result<usize, Error> {
executor.observers_mut().pre_exec_all(state, &input)?;
executor.observers_mut().pre_exec_all(state, input)?;
let exit_kind = executor.run_target(fuzzer, state, manager, &input)?;
let exit_kind = executor.run_target(fuzzer, state, manager, input)?;
let observers = executor.observers();
let observer = observers[observer_handle].as_ref();
@ -347,7 +337,7 @@ where
executor
.observers_mut()
.post_exec_all(state, &input, &exit_kind)?;
.post_exec_all(state, input, &exit_kind)?;
// let observers = executor.observers();
// fuzzer.process_execution(state, manager, input, observers, &exit_kind, true)?;