Skip to content

Commit

Permalink
aaa
Browse files Browse the repository at this point in the history
  • Loading branch information
rmalmain committed Jun 24, 2024
1 parent 904df9a commit 7697efe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions libafl/src/corpus/testcase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use serde::{Deserialize, Serialize};
use super::Corpus;
use crate::{
corpus::CorpusId,
feedbacks::{MapFeedbackMetadata, MapIndexesMetadata},
inputs::{Input, UsesInput},
Error, HasMetadata,
};
Expand Down Expand Up @@ -109,27 +110,33 @@ where
/// Timestamp from epoch
#[cfg(feature = "dump_state")]
timestamp: Duration,
map_feedbeck_metadata: Option<MapIndexesMetadata>,
}

#[cfg(feature = "dump_state")]
#[cfg(all(feature = "std", feature = "dump_state"))]
impl<I> TryFrom<Testcase<I>> for TestcaseDump<I>
where
I: Input,
{
type Error = Error;

fn try_from(tc: Testcase<I>) -> Result<Self, Self::Error> {
log::info!("testcase metadata: {:?}", tc.metadata);
let map_fb = tc.metadata.get::<MapIndexesMetadata>();

Ok(TestcaseDump {
input: tc.input.clone().ok_or(Error::empty("No input loaded"))?,
exec_time: tc.exec_time,
parent_id: tc.parent_id,
disabled: tc.disabled,
objectives_found: tc.objectives_found,
#[cfg(feature = "track_hit_feedbacks")]
hit_feedbacks: tc.hit_feedbacks,
hit_feedbacks: tc.hit_feedbacks.clone(),
#[cfg(feature = "track_hit_feedbacks")]
hit_objectives: tc.hit_objectives,
hit_objectives: tc.hit_objectives.clone(),
timestamp: tc.timestamp,
map_feedbeck_metadata: map_fb.cloned(),
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/feedbacks/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ where
}

/// A testcase metadata holding a list of indexes of a map
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(
any(not(feature = "serdeany_autoreg"), miri),
allow(clippy::unsafe_derive_deserialize)
Expand Down

0 comments on commit 7697efe

Please sign in to comment.