Skip to content

Commit

Permalink
increase havoc_stack_pow2 on no finds
Browse files Browse the repository at this point in the history
  • Loading branch information
vanhauser-thc committed Sep 28, 2020
1 parent e85fde2 commit e69b25e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/afl-fuzz.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ typedef struct afl_state {

u8 cal_cycles, /* Calibration cycles defaults */
cal_cycles_long, /* Calibration cycles defaults */
havoc_stack_pow2, /* HAVOC_STACK_POW2 */
no_unlink, /* do not unlink cur_input */
debug, /* Debug mode */
custom_only, /* Custom mutator only mode */
Expand Down
4 changes: 2 additions & 2 deletions src/afl-fuzz-one.c
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ u8 fuzz_one_original(afl_state_t *afl) {

for (afl->stage_cur = 0; afl->stage_cur < afl->stage_max; ++afl->stage_cur) {

u32 use_stacking = 1 << (1 + rand_below(afl, HAVOC_STACK_POW2));
u32 use_stacking = 1 << (1 + rand_below(afl, afl->havoc_stack_pow2));

afl->stage_cur_val = use_stacking;

Expand Down Expand Up @@ -3970,7 +3970,7 @@ static u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) {
for (afl->stage_cur = 0; afl->stage_cur < afl->stage_max;
++afl->stage_cur) {

u32 use_stacking = 1 << (1 + rand_below(afl, HAVOC_STACK_POW2));
u32 use_stacking = 1 << (1 + rand_below(afl, afl->havoc_stack_pow2));

afl->stage_cur_val = use_stacking;

Expand Down
1 change: 1 addition & 0 deletions src/afl-fuzz-state.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void afl_state_init(afl_state_t *afl, uint32_t map_size) {
afl->stage_name = "init"; /* Name of the current fuzz stage */
afl->splicing_with = -1; /* Splicing with which test case? */
afl->cpu_to_bind = -1;
afl->havoc_stack_pow2 = HAVOC_STACK_POW2;
afl->cal_cycles = CAL_CYCLES;
afl->cal_cycles_long = CAL_CYCLES_LONG;
afl->hang_tmout = EXEC_TIMEOUT;
Expand Down
5 changes: 5 additions & 0 deletions src/afl-fuzz.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,9 +1368,14 @@ int main(int argc, char **argv_orig, char **envp) {
break;
case 2:
// if (!have_p) afl->schedule = EXPLOIT;
afl->havoc_stack_pow2++;
afl->expand_havoc = 3;
break;
case 3:
afl->havoc_stack_pow2++;
afl->expand_havoc = 4;
break;
case 4:
// nothing else currently
break;

Expand Down

0 comments on commit e69b25e

Please sign in to comment.