parent
fda1596ee2
commit
f0da4d15da
@ -8,7 +8,7 @@ use libafl_bolts::rands::Rand;
|
|||||||
use crate::{inputs::bytes::BytesInput, nonzero, state::HasRand, Error};
|
use crate::{inputs::bytes::BytesInput, nonzero, state::HasRand, Error};
|
||||||
|
|
||||||
pub mod gramatron;
|
pub mod gramatron;
|
||||||
use core::cmp::min;
|
use core::cmp::max;
|
||||||
|
|
||||||
pub use gramatron::*;
|
pub use gramatron::*;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ where
|
|||||||
{
|
{
|
||||||
fn generate(&mut self, state: &mut S) -> Result<BytesInput, Error> {
|
fn generate(&mut self, state: &mut S) -> Result<BytesInput, Error> {
|
||||||
let mut size = state.rand_mut().below(self.max_size);
|
let mut size = state.rand_mut().below(self.max_size);
|
||||||
size = min(size, 1);
|
size = max(size, 1);
|
||||||
let random_bytes: Vec<u8> = (0..size)
|
let random_bytes: Vec<u8> = (0..size)
|
||||||
.map(|_| state.rand_mut().below(nonzero!(256)) as u8)
|
.map(|_| state.rand_mut().below(nonzero!(256)) as u8)
|
||||||
.collect();
|
.collect();
|
||||||
@ -111,7 +111,7 @@ where
|
|||||||
{
|
{
|
||||||
fn generate(&mut self, state: &mut S) -> Result<BytesInput, Error> {
|
fn generate(&mut self, state: &mut S) -> Result<BytesInput, Error> {
|
||||||
let mut size = state.rand_mut().below(self.max_size);
|
let mut size = state.rand_mut().below(self.max_size);
|
||||||
size = min(size, 1);
|
size = max(size, 1);
|
||||||
let printables = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \t\n!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".as_bytes();
|
let printables = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \t\n!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".as_bytes();
|
||||||
let random_bytes: Vec<u8> = (0..size)
|
let random_bytes: Vec<u8> = (0..size)
|
||||||
.map(|_| *state.rand_mut().choose(printables).unwrap())
|
.map(|_| *state.rand_mut().choose(printables).unwrap())
|
||||||
|
@ -62,6 +62,7 @@ impl FridaRuntime for CoverageRuntime {
|
|||||||
impl CoverageRuntime {
|
impl CoverageRuntime {
|
||||||
/// Create a new coverage runtime
|
/// Create a new coverage runtime
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
#[allow(clippy::large_stack_arrays)]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self(Rc::pin(RefCell::new(CoverageRuntimeInner {
|
Self(Rc::pin(RefCell::new(CoverageRuntimeInner {
|
||||||
map: [0_u8; MAP_SIZE],
|
map: [0_u8; MAP_SIZE],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user