File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,11 @@ use std::ops::RangeInclusive;
3
3
4
4
/// Holds the range of acceptable values to use during the generation of testcases
5
5
pub struct Config {
6
- pub test_case_inputs : RangeInclusive < usize > ,
6
+ /// Maximum allowed test case inputs.
7
+ /// We build test case inputs from the rest of the bytes that the fuzzer provides us
8
+ /// so we allow the fuzzer to control this by feeding us more or less bytes.
9
+ /// The upper bound here is to prevent too many inputs that cause long test times
10
+ pub max_test_case_inputs : usize ,
7
11
pub signature_params : RangeInclusive < usize > ,
8
12
pub signature_rets : RangeInclusive < usize > ,
9
13
pub instructions_per_block : RangeInclusive < usize > ,
@@ -65,7 +69,7 @@ pub struct Config {
65
69
impl Default for Config {
66
70
fn default ( ) -> Self {
67
71
Config {
68
- test_case_inputs : 1 ..= 10 ,
72
+ max_test_case_inputs : 100 ,
69
73
signature_params : 0 ..=16 ,
70
74
signature_rets : 0 ..=16 ,
71
75
instructions_per_block : 0 ..=64 ,
Original file line number Diff line number Diff line change @@ -149,7 +149,10 @@ where
149
149
fn generate_test_inputs ( mut self , signature : & Signature ) -> Result < Vec < TestCaseInput > > {
150
150
let mut inputs = Vec :: new ( ) ;
151
151
152
- loop {
152
+ // Generate up to "max_test_case_inputs" inputs, we need an upper bound here since
153
+ // the fuzzer at some point starts trying to feed us way too many inputs. (I found one
154
+ // test case with 130k inputs!)
155
+ for _ in 0 ..self . config . max_test_case_inputs {
153
156
let last_len = self . u . len ( ) ;
154
157
155
158
let test_args = signature
You can’t perform that action at this time.
0 commit comments