Compare commits

...

1 Commits
v4.21c ... 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", "custom_mutator",
"example", "example",
# Lain needs a nightly toolchain # Lain needs a nightly toolchain
# "example_lain", "example_lain",
] ]

View File

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

View File

@ -4,8 +4,9 @@ use custom_mutator::{export_mutator, CustomMutator};
use lain::{ use lain::{
mutator::Mutator, mutator::Mutator,
prelude::*, 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)] #[derive(Debug, Mutatable, NewFuzzed, BinarySerialize)]
struct MyStruct { struct MyStruct {
@ -25,7 +26,7 @@ struct MyStruct {
} }
struct LainMutator { struct LainMutator {
mutator: Mutator<StdRng>, mutator: Mutator<StdRand>,
buffer: Vec<u8>, buffer: Vec<u8>,
} }
@ -34,7 +35,7 @@ impl CustomMutator for LainMutator {
fn init(seed: u32) -> Result<Self, ()> { fn init(seed: u32) -> Result<Self, ()> {
Ok(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(), buffer: Vec::new(),
}) })
} }