From 4de182afc9b7c8fd415df4d978e3f85fe6f391e0 Mon Sep 17 00:00:00 2001 From: Dhanvith Nayak Date: Sun, 15 Dec 2024 23:46:44 +0530 Subject: [PATCH] fix mismatched types --- libafl/src/events/llmp/mod.rs | 19 ++++++++++++++++--- libafl/src/stages/sync.rs | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libafl/src/events/llmp/mod.rs b/libafl/src/events/llmp/mod.rs index e8a284973c..586dea66c8 100644 --- a/libafl/src/events/llmp/mod.rs +++ b/libafl/src/events/llmp/mod.rs @@ -18,7 +18,7 @@ use serde::Deserialize; #[cfg(feature = "share_objectives")] use crate::{ corpus::{Corpus, Testcase}, - state::{HasCorpus, HasSolutions}, + state::{HasCurrentTestcase, HasSolutions}, }; use crate::{ events::{CustomBufEventResult, CustomBufHandlerFn, Event, EventFirer}, @@ -395,7 +395,14 @@ where #[cfg(feature = "share_objectives")] impl LlmpEventConverter where - S: UsesInput + HasExecutions + HasMetadata + Stoppable + HasCorpus + HasSolutions, + S: UsesInput + + HasExecutions + + HasSolutions + + HasMetadata + + Stoppable + + State + + HasCurrentTestcase, + S::Solutions: Corpus, SP: ShMemProvider, IC: InputConverter, ICB: InputConverter, @@ -447,8 +454,14 @@ where return Ok(()); }; - let testcase = Testcase::from(converter.convert(input)?); + let converted_input = converter.convert(input)?; + let mut testcase = Testcase::from(converted_input); testcase.set_parent_id_optional(*state.corpus().current()); + + if let Ok(mut tc) = state.current_testcase_mut() { + tc.found_objective(); + } + state.solutions_mut().add(testcase)?; log::info!("Added received Objective to Corpus"); diff --git a/libafl/src/stages/sync.rs b/libafl/src/stages/sync.rs index a0ce464025..8cc521dd62 100644 --- a/libafl/src/stages/sync.rs +++ b/libafl/src/stages/sync.rs @@ -351,6 +351,7 @@ where DI: Input, <::Corpus as Corpus>::Input: Clone, S::Corpus: Corpus, // delete me + S::Solutions: Corpus, { #[inline] fn perform(