diff options
author | van Hauser <vh@thc.org> | 2020-05-15 08:36:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 08:36:51 +0200 |
commit | 87a693d1a956fd0fcb0ebbdecff24053b69e8560 (patch) | |
tree | 34578ae146ad79b7748363f23fe022a8e6c1a76d /src/afl-fuzz-run.c | |
parent | 1317433a51a7f7336c82c80a592835ddda9ef60f (diff) | |
parent | 49bd24144a881f4f55ef1a3db9a7f129a6670488 (diff) | |
download | afl++-87a693d1a956fd0fcb0ebbdecff24053b69e8560.tar.gz |
Merge pull request #360 from AFLplusplus/dev 2.65c
new code formatting + applied
Diffstat (limited to 'src/afl-fuzz-run.c')
-rw-r--r-- | src/afl-fuzz-run.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c index 4a22dad6..bbcd9a99 100644 --- a/src/afl-fuzz-run.c +++ b/src/afl-fuzz-run.c @@ -97,10 +97,10 @@ void write_to_testcase(afl_state_t *afl, void *mem, u32 len) { LIST_FOREACH(&afl->custom_mutator_list, struct custom_mutator, { - if (el->afl_custom_pre_save) { + if (el->afl_custom_post_process) { new_size = - el->afl_custom_pre_save(el->data, new_mem, new_size, &new_buf); + el->afl_custom_post_process(el->data, new_mem, new_size, &new_buf); } @@ -110,7 +110,7 @@ void write_to_testcase(afl_state_t *afl, void *mem, u32 len) { if (unlikely(!new_buf && (new_size <= 0))) { - FATAL("Custom_pre_save failed (ret: %lu)", (long unsigned)new_size); + FATAL("Custom_post_process failed (ret: %lu)", (long unsigned)new_size); } else if (likely(new_buf)) { @@ -119,7 +119,7 @@ void write_to_testcase(afl_state_t *afl, void *mem, u32 len) { } else { - /* custom mutators do not has a custom_pre_save function */ + /* custom mutators do not has a custom_post_process function */ afl_fsrv_write_to_testcase(&afl->fsrv, mem, len); } @@ -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; @@ -401,6 +401,20 @@ void sync_fuzzers(afl_state_t *afl) { } + /* + // a slave only syncs from a master, a master syncs from everyone + if (likely(afl->is_slave)) { + + u8 x = alloc_printf("%s/%s/is_master", afl->sync_dir, sd_ent->d_name); + int res = access(x, F_OK); + free(x); + if (res != 0) + continue; + + } + + */ + /* Skip anything that doesn't have a queue/ subdirectory. */ qd_path = alloc_printf("%s/%s/queue", afl->sync_dir, sd_ent->d_name); @@ -690,18 +704,6 @@ u8 common_fuzz_stuff(afl_state_t *afl, u8 *out_buf, u32 len) { u8 fault; - if (afl->post_handler) { - - u8 *post_buf = NULL; - - size_t post_len = - afl->post_handler(afl->post_data, out_buf, len, &post_buf); - if (!post_buf || !post_len) { return 0; } - out_buf = post_buf; - len = post_len; - - } - write_to_testcase(afl, out_buf, len); fault = fuzz_run_target(afl, &afl->fsrv, afl->fsrv.exec_tmout); |