Skip to content

Commit cee4b45

Browse files
Merge pull request AFLplusplus#379 from arnow117/master
Fix MOpt implementation flaws
2 parents 434ccf3 + dab498c commit cee4b45

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/afl-fuzz-one.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4250,14 +4250,29 @@ static u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) {
42504250
u64 temp_temp_puppet =
42514251
afl->queued_paths + afl->unique_crashes - temp_total_found;
42524252
afl->total_puppet_find = afl->total_puppet_find + temp_temp_puppet;
4253-
for (i = 0; i < operator_num; ++i) {
42544253

4255-
if (MOpt_globals.cycles_v2[i] > MOpt_globals.cycles_v3[i]) {
4254+
if (MOpt_globals.is_pilot_mode){
42564255

4257-
MOpt_globals.finds_v2[i] += temp_temp_puppet;
4256+
for (i = 0; i < operator_num; ++i) {
4257+
4258+
if (MOpt_globals.cycles_v2[i] > MOpt_globals.cycles_v3[i]) {
4259+
4260+
MOpt_globals.finds_v2[i] += temp_temp_puppet;
4261+
4262+
}
42584263

42594264
}
42604265

4266+
} else {
4267+
4268+
for (i = 0; i < operator_num; i++) {
4269+
4270+
if (afl->core_operator_cycles_puppet_v2[i] > afl->core_operator_cycles_puppet_v3[i])
4271+
4272+
afl->core_operator_finds_puppet_v2[i] += temp_temp_puppet;
4273+
4274+
}
4275+
42614276
}
42624277

42634278
} /* if */
@@ -4437,7 +4452,6 @@ static u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) {
44374452

44384453
afl->total_pacemaker_time += *MOpt_globals.pTime;
44394454
*MOpt_globals.pTime = 0;
4440-
afl->temp_puppet_find = afl->total_puppet_find;
44414455
new_hit_cnt = afl->queued_paths + afl->unique_crashes;
44424456

44434457
if (MOpt_globals.is_pilot_mode) {
@@ -4448,6 +4462,7 @@ static u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) {
44484462

44494463
}
44504464

4465+
afl->temp_puppet_find = afl->total_puppet_find;
44514466
u64 temp_stage_finds_puppet = 0;
44524467
for (i = 0; i < operator_num; ++i) {
44534468

@@ -4530,6 +4545,15 @@ static u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) {
45304545

45314546
} else {
45324547

4548+
for (i = 0; i < operator_num; i++)
4549+
{
4550+
4551+
afl->core_operator_finds_puppet[i] = afl->core_operator_finds_puppet_v2[i];
4552+
afl->core_operator_cycles_puppet[i] = afl->core_operator_cycles_puppet_v2[i];
4553+
temp_stage_finds_puppet += afl->core_operator_finds_puppet[i];
4554+
4555+
}
4556+
45334557
afl->key_module = 2;
45344558

45354559
afl->old_hit_count = new_hit_cnt;

0 commit comments

Comments
 (0)