diff --git a/afl/Cargo.toml b/afl/Cargo.toml index d6ca4c4758..71775a583b 100644 --- a/afl/Cargo.toml +++ b/afl/Cargo.toml @@ -14,9 +14,10 @@ default = ["std"] std = [] [dependencies] -hashbrown = "0.9" # A faster hashmap, nostd compatible +hashbrown = { version = "0.9", features = ["serde"] } # A faster hashmap, nostd compatible libc = "0.2" # For (*nix) libc num = "*" xxhash-rust = { version = "0.8.0-beta.5", features = ["xxh3"] } # xxh3 hashing for rust serde = { version = "1.0", default-features = false, features = ["alloc"] } # serialization lib +serde_traitobject = { version = "0.2.7" } # trait obj serialization lib postcard = "0.5.1" # no_std compatible serde serialization fromat \ No newline at end of file diff --git a/afl/src/corpus/testcase.rs b/afl/src/corpus/testcase.rs index 37940f058c..05f91c0bde 100644 --- a/afl/src/corpus/testcase.rs +++ b/afl/src/corpus/testcase.rs @@ -1,12 +1,13 @@ use alloc::boxed::Box; use alloc::rc::Rc; use alloc::string::String; +use core::any::Any; use core::cell::RefCell; use core::convert::Into; use core::default::Default; use core::option::Option; use hashbrown::HashMap; -use serde::{Deserialize, Serialize}; +use serde_traitobject::{Deserialize, Serialize}; use crate::inputs::Input; use crate::AflError; @@ -17,7 +18,7 @@ use crate::AflError; // TODO: Give example /// Metadata for a testcase -pub trait TestcaseMetadata { +pub trait TestcaseMetadata: Any + Serialize + Deserialize<'static> { /// The name of this metadata - used to find it in the list of avaliable metadatas fn name(&self) -> &'static str; } diff --git a/afl/src/feedbacks/mod.rs b/afl/src/feedbacks/mod.rs index 2481020891..91c94f897a 100644 --- a/afl/src/feedbacks/mod.rs +++ b/afl/src/feedbacks/mod.rs @@ -4,6 +4,7 @@ use alloc::vec::Vec; use core::cell::RefCell; use core::marker::PhantomData; use num::Integer; +use serde::{Deserialize, Serialize}; use crate::corpus::{Testcase, TestcaseMetadata}; use crate::inputs::Input; @@ -165,6 +166,7 @@ where } } +#[derive(Serialize, Deserialize)] pub struct MapNoveltiesMetadata { novelties: Vec, }