Compare commits

...

1 Commits
4.02c ... lief

Author SHA1 Message Date
90c6199e69 started adding lief 2021-07-21 01:29:53 +02:00
4 changed files with 7 additions and 5 deletions

View File

@ -4,5 +4,5 @@ members = [
"custom_mutator",
"example",
# Lain needs a nightly toolchain
# "example_lain",
"example_lain",
]

View File

@ -9,6 +9,7 @@ edition = "2018"
[dependencies]
custom_mutator = { path = "../custom_mutator" }
lain="0.5"
libafl= {version = "0.5", default-features = false, features = ["std", "rand_trait"]}
[[example]]
name = "example_lain"

View File

@ -4,8 +4,9 @@ use custom_mutator::{export_mutator, CustomMutator};
use lain::{
mutator::Mutator,
prelude::*,
rand::{rngs::StdRng, SeedableRng},
};
// We're using RomuRand from LibAFL instead of the slower rand trait.
use libafl::bolts::rands::StdRand;
#[derive(Debug, Mutatable, NewFuzzed, BinarySerialize)]
struct MyStruct {
@ -25,7 +26,7 @@ struct MyStruct {
}
struct LainMutator {
mutator: Mutator<StdRng>,
mutator: Mutator<StdRand>,
buffer: Vec<u8>,
}
@ -34,7 +35,7 @@ impl CustomMutator for LainMutator {
fn init(seed: u32) -> Result<Self, ()> {
Ok(Self {
mutator: Mutator::new(StdRng::seed_from_u64(seed as u64)),
mutator: Mutator::new(StdRand::with_seed(seed as u64)),
buffer: Vec::new(),
})
}