aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-13 00:41:24 +0200
committervan Hauser <vh@thc.org>2020-05-13 00:41:24 +0200
commitf8b3d34225102158ed585130e3de08772e989b53 (patch)
tree41ccb6babf34efe2aba37e5c5fee32a95799718a /src
parent5273c61cd84fb5db4bd4c97509f60511c7a9bb6d (diff)
downloadafl++-f8b3d34225102158ed585130e3de08772e989b53.tar.gz
move has_new_bits for better performance
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz-run.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c
index 4a22dad6..468b5fc6 100644
--- a/src/afl-fuzz-run.c
+++ b/src/afl-fuzz-run.c
@@ -191,7 +191,7 @@ static void write_with_gap(afl_state_t *afl, void *mem, u32 len, u32 skip_at,
u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
u32 handicap, u8 from_queue) {
- u8 fault = 0, new_bits = 0, var_detected = 0,
+ u8 fault = 0, new_bits = 0, var_detected = 0, hnb = 0,
first_run = (q->exec_cksum == 0);
u64 start_us, stop_us;
@@ -236,7 +236,7 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
if (q->exec_cksum) {
memcpy(afl->first_trace, afl->fsrv.trace_bits, afl->fsrv.map_size);
- u8 hnb = has_new_bits(afl, afl->virgin_bits);
+ hnb = has_new_bits(afl, afl->virgin_bits);
if (hnb > new_bits) { new_bits = hnb; }
}
@@ -271,11 +271,11 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
}
cksum = hash32(afl->fsrv.trace_bits, afl->fsrv.map_size, HASH_CONST);
- u8 hnb = has_new_bits(afl, afl->virgin_bits);
- if (hnb > new_bits) { new_bits = hnb; }
-
if (q->exec_cksum != cksum) {
+ hnb = has_new_bits(afl, afl->virgin_bits);
+ if (hnb > new_bits) { new_bits = hnb; }
+
if (q->exec_cksum) {
u32 i;