Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.

Commit fec26fa

Browse files
fix negative stability bug (#92)
1 parent b6bb2f1 commit fec26fa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

afl-fuzz.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,7 +2556,7 @@ static u8 calibrate_case(char** argv, struct queue_entry* q, u8* use_mem,
25562556

25572557
static u8 first_trace[MAP_SIZE];
25582558

2559-
u8 fault = 0, new_bits = 0, var_detected = 0,
2559+
u8 fault = 0, new_bits = 0, var_detected = 0, hnb = 0,
25602560
first_run = (q->exec_cksum == 0);
25612561

25622562
u64 start_us, stop_us;
@@ -2584,7 +2584,13 @@ static u8 calibrate_case(char** argv, struct queue_entry* q, u8* use_mem,
25842584
if (dumb_mode != 1 && !no_forkserver && !forksrv_pid)
25852585
init_forkserver(argv);
25862586

2587-
if (q->exec_cksum) memcpy(first_trace, trace_bits, MAP_SIZE);
2587+
if (q->exec_cksum) {
2588+
2589+
memcpy(first_trace, trace_bits, MAP_SIZE);
2590+
hnb = has_new_bits(virgin_bits);
2591+
if (hnb > new_bits) new_bits = hnb;
2592+
2593+
}
25882594

25892595
start_us = get_cur_time_us();
25902596

@@ -2612,7 +2618,7 @@ static u8 calibrate_case(char** argv, struct queue_entry* q, u8* use_mem,
26122618

26132619
if (q->exec_cksum != cksum) {
26142620

2615-
u8 hnb = has_new_bits(virgin_bits);
2621+
hnb = has_new_bits(virgin_bits);
26162622
if (hnb > new_bits) new_bits = hnb;
26172623

26182624
if (q->exec_cksum) {

0 commit comments

Comments
 (0)