diff options
author | Andrea Fioraldi <andreafioraldi@gmail.com> | 2020-02-07 17:00:11 +0100 |
---|---|---|
committer | Andrea Fioraldi <andreafioraldi@gmail.com> | 2020-02-07 17:00:11 +0100 |
commit | 1e10e452aaa366c3d06e7eda9f56f127fbf25319 (patch) | |
tree | 8fa43f52a48f5fe7ef1a54f61f2c4466dd777276 | |
parent | ea37d8cef9648dfbe317517959be3d4eb9cb6cc7 (diff) | |
download | afl++-1e10e452aaa366c3d06e7eda9f56f127fbf25319.tar.gz |
fix empty range bug in colorization
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | qemu_mode/patches/afl-qemu-cpu-inl.h | 4 | ||||
-rw-r--r-- | src/afl-fuzz-redqueen.c | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile index 13be4ec9..70eac6b9 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ ifneq "$(shell uname -m)" "x86_64" endif CFLAGS ?= -O3 -funroll-loops $(CFLAGS_OPT) -CFLAGS += -Wall -g -Wno-pointer-sign -I include/ \ +override CFLAGS += -Wall -g -Wno-pointer-sign -I include/ \ -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \ -DDOC_PATH=\"$(DOC_PATH)\" -Wno-unused-function diff --git a/qemu_mode/patches/afl-qemu-cpu-inl.h b/qemu_mode/patches/afl-qemu-cpu-inl.h index 0ae6364b..9a98fde3 100644 --- a/qemu_mode/patches/afl-qemu-cpu-inl.h +++ b/qemu_mode/patches/afl-qemu-cpu-inl.h @@ -368,8 +368,10 @@ static void afl_forkserver(CPUState *cpu) { if (WIFSTOPPED(status)) child_stopped = 1; - else if (unlikely(first_run && is_persistent)) + else if (unlikely(first_run && is_persistent)) { + fprintf(stderr, "[AFL] ERROR: no persistent iteration executed\n"); exit(12); // Persistent is wrong + } first_run = 0; if (write(FORKSRV_FD + 1, &status, 4) != 4) exit(7); diff --git a/src/afl-fuzz-redqueen.c b/src/afl-fuzz-redqueen.c index d46d2b19..bac7357e 100644 --- a/src/afl-fuzz-redqueen.c +++ b/src/afl-fuzz-redqueen.c @@ -122,6 +122,9 @@ u8 colorization(u8* buf, u32 len, u32 exec_cksum) { while ((rng = pop_biggest_range(&ranges)) != NULL && stage_cur) { u32 s = rng->end - rng->start; + if (s == 0) + goto empty_range; + memcpy(backup, buf + rng->start, s); rand_replace(buf + rng->start, s); @@ -136,6 +139,7 @@ u8 colorization(u8* buf, u32 len, u32 exec_cksum) { } else needs_write = 1; +empty_range: ck_free(rng); --stage_cur; |