fix some cmplog refactoring bugs

This commit is contained in:
Andrea Fioraldi
2020-04-13 10:40:24 +02:00
parent 995e556065
commit 0022cc4782
2 changed files with 10 additions and 6 deletions

View File

@ -46,7 +46,7 @@ u8 run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) {
must prevent any earlier operations from venturing into that
territory. */
memset(fsrv->trace_bits, 0, fsrv->map_size);
if (fsrv->trace_bits) memset(fsrv->trace_bits, 0, fsrv->map_size);
MEM_BARRIER();
@ -120,6 +120,8 @@ u8 run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) {
MEM_BARRIER();
if (fsrv->trace_bits) {
tb4 = *(u32 *)fsrv->trace_bits;
#ifdef WORD_SIZE_64
@ -128,6 +130,8 @@ u8 run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) {
classify_counts(afl, (u32 *)fsrv->trace_bits);
#endif /* ^WORD_SIZE_64 */
}
fsrv->prev_timed_out = fsrv->child_timed_out;
/* Report outcome to caller. */
@ -312,7 +316,7 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
if (!afl->fsrv.fsrv_pid) {
if (afl->shm.cmplog_mode &&
if (afl->fsrv.cmplog_binary &&
afl->fsrv.init_child_func != cmplog_exec_child) {
FATAL("BUG in afl-fuzz detected. Cmplog mode not set correctly.");

View File

@ -1019,7 +1019,7 @@ int main(int argc, char **argv_orig, char **envp) {
if (afl->cmplog_binary) {
SAYF("Spawning cmplog forkserver");
ACTF("Spawning cmplog forkserver");
afl_fsrv_init_dup(&afl->cmplog_fsrv, &afl->fsrv);
// TODO: this is semi-nice
afl->cmplog_fsrv.cmplog_binary = afl->cmplog_binary;