Delete useless trait bounds from share_objectives feature (#2908)

* fix

* a
This commit is contained in:
Dongjia "toka" Zhang 2025-01-29 13:55:38 +01:00 committed by GitHub
parent 5002336fad
commit fd6271fa35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 39 deletions

View File

@ -14,8 +14,6 @@ use libafl_bolts::{
};
use serde::{de::DeserializeOwned, Serialize};
#[cfg(feature = "share_objectives")]
use crate::corpus::{Corpus, Testcase};
use crate::{
events::{Event, EventFirer},
fuzzer::EvaluatorObservers,
@ -262,7 +260,6 @@ where
) -> Result<(), Error>
where
ICB: InputConverter<To = I, From = DI>,
S: HasCurrentTestcase<I> + HasSolutions<I>,
Z: EvaluatorObservers<E, EM, I, S>,
{
match event {
@ -297,17 +294,17 @@ where
return Ok(());
};
let converted_input = converter.convert(input)?;
let mut testcase = Testcase::from(converted_input);
testcase.set_parent_id_optional(*state.corpus().current());
let res = fuzzer.evaluate_input_with_observers(
state,
executor,
manager,
converter.convert(input)?,
false,
)?;
if let Ok(mut tc) = state.current_testcase_mut() {
tc.found_objective();
if let Some(item) = res.1 {
log::info!("Added received Objective as item #{item}");
}
state.solutions_mut().add(testcase)?;
log::info!("Added received Objective to Corpus");
Ok(())
}
Event::Stop => Ok(()),

View File

@ -47,8 +47,6 @@ use libafl_bolts::{
use serde::{de::DeserializeOwned, Serialize};
use typed_builder::TypedBuilder;
#[cfg(feature = "share_objectives")]
use crate::corpus::{Corpus, Testcase};
#[cfg(feature = "llmp_compression")]
use crate::events::COMPRESS_THRESHOLD;
#[cfg(all(unix, not(miri)))]
@ -575,7 +573,7 @@ where
event: Event<I>,
) -> Result<(), Error>
where
S: HasImported + HasSolutions<I> + HasCurrentTestcase<I> + Stoppable,
S: HasImported + Stoppable,
EMH: EventManagerHooksTuple<I, S>,
I: Input,
E: HasObservers,
@ -623,16 +621,17 @@ where
#[cfg(feature = "share_objectives")]
Event::Objective { input, .. } => {
log::debug!("Received new Objective");
let mut testcase = Testcase::from(input);
testcase.set_parent_id_optional(*state.corpus().current());
#[cfg(feature = "std")]
log::debug!("[{}] Received new Objective", std::process::id());
if let Ok(mut tc) = state.current_testcase_mut() {
tc.found_objective();
let res =
fuzzer.evaluate_input_with_observers(state, executor, self, input, false)?;
if let Some(item) = res.1 {
*state.imported_mut() += 1;
log::debug!("Added received Objective {evt_name} as item #{item}");
} else {
log::debug!("Objective {evt_name} was discarded");
}
state.solutions_mut().add(testcase)?;
log::info!("Added received Objective to Corpus");
}
Event::Stop => {
state.request_stop();

View File

@ -39,8 +39,6 @@ use tokio::{
use typed_builder::TypedBuilder;
use super::{std_maybe_report_progress, std_report_progress, AwaitRestartSafe, SendExiting};
#[cfg(feature = "share_objectives")]
use crate::corpus::{Corpus, Testcase};
#[cfg(all(unix, not(miri)))]
use crate::events::EVENTMGR_SIGHANDLER_STATE;
use crate::{
@ -565,12 +563,7 @@ impl<EMH, I, S> Drop for TcpEventManager<EMH, I, S> {
impl<EMH, I, S> TcpEventManager<EMH, I, S>
where
EMH: EventManagerHooksTuple<I, S>,
S: HasExecutions
+ HasMetadata
+ HasImported
+ HasSolutions<I>
+ HasCurrentTestcase<I>
+ Stoppable,
S: HasExecutions + HasMetadata + HasImported + Stoppable,
{
/// Write the client id for a client `EventManager` to env vars
pub fn to_env(&self, env_name: &str) {
@ -623,16 +616,14 @@ where
#[cfg(feature = "share_objectives")]
Event::Objective { input, .. } => {
log::debug!("Received new Objective");
let mut testcase = Testcase::from(input);
testcase.set_parent_id_optional(*state.corpus().current());
log::info!("Received new Objective");
if let Ok(mut tc) = state.current_testcase_mut() {
tc.found_objective();
let res =
fuzzer.evaluate_input_with_observers(state, executor, self, input, false)?;
if let Some(item) = res.1 {
*state.imported_mut() += 1;
log::info!("Added received Testcase as item #{item}");
}
state.solutions_mut().add(testcase)?;
log::info!("Added received Objective to Corpus");
}
Event::Stop => {
state.request_stop();