Skip to content

Commit f0da4d1

Browse files
authored
Fix Generator (#2627)
* no min but max * import * large stack arrays ?
1 parent fda1596 commit f0da4d1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

libafl/src/generators/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use libafl_bolts::rands::Rand;
88
use crate::{inputs::bytes::BytesInput, nonzero, state::HasRand, Error};
99

1010
pub mod gramatron;
11-
use core::cmp::min;
11+
use core::cmp::max;
1212

1313
pub use gramatron::*;
1414

@@ -83,7 +83,7 @@ where
8383
{
8484
fn generate(&mut self, state: &mut S) -> Result<BytesInput, Error> {
8585
let mut size = state.rand_mut().below(self.max_size);
86-
size = min(size, 1);
86+
size = max(size, 1);
8787
let random_bytes: Vec<u8> = (0..size)
8888
.map(|_| state.rand_mut().below(nonzero!(256)) as u8)
8989
.collect();
@@ -111,7 +111,7 @@ where
111111
{
112112
fn generate(&mut self, state: &mut S) -> Result<BytesInput, Error> {
113113
let mut size = state.rand_mut().below(self.max_size);
114-
size = min(size, 1);
114+
size = max(size, 1);
115115
let printables = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \t\n!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".as_bytes();
116116
let random_bytes: Vec<u8> = (0..size)
117117
.map(|_| *state.rand_mut().choose(printables).unwrap())

libafl_frida/src/coverage_rt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ impl FridaRuntime for CoverageRuntime {
6262
impl CoverageRuntime {
6363
/// Create a new coverage runtime
6464
#[must_use]
65+
#[allow(clippy::large_stack_arrays)]
6566
pub fn new() -> Self {
6667
Self(Rc::pin(RefCell::new(CoverageRuntimeInner {
6768
map: [0_u8; MAP_SIZE],

0 commit comments

Comments
 (0)