aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-03-15 23:14:07 +0100
committerGitHub <noreply@github.com>2021-03-15 23:14:07 +0100
commit23f7bee81c46ad4f0f65fa56d08064ab5f1e2e6f (patch)
tree79c15c7a4f879c90f683a61a8ad878bd19e2a69e /src
parente5bdba4b9f22c0f2e4ff60ffc9bfa8fbaeb586d2 (diff)
parentac795ae1e154df87d422eb9a307ee1f40fcb701f (diff)
downloadafl++-23f7bee81c46ad4f0f65fa56d08064ab5f1e2e6f.tar.gz
Merge pull request #820 from AFLplusplus/dev3.11c
push to stable
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz-queue.c2
-rw-r--r--src/afl-fuzz-stats.c20
-rw-r--r--src/afl-fuzz.c5
3 files changed, 14 insertions, 13 deletions
diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c
index 835aba40..b2f88205 100644
--- a/src/afl-fuzz-queue.c
+++ b/src/afl-fuzz-queue.c
@@ -325,7 +325,7 @@ static u8 check_if_text(afl_state_t *afl, struct queue_entry *q) {
if (len >= MAX_FILE) len = MAX_FILE - 1;
if ((fd = open(q->fname, O_RDONLY)) < 0) return 0;
- buf = afl_realloc(AFL_BUF_PARAM(in_scratch), len);
+ buf = afl_realloc(AFL_BUF_PARAM(in_scratch), len + 1);
comp = read(fd, buf, len);
close(fd);
if (comp != (ssize_t)len) return 0;
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c
index 2e7de7b3..99059a2d 100644
--- a/src/afl-fuzz-stats.c
+++ b/src/afl-fuzz-stats.c
@@ -645,6 +645,13 @@ void show_stats(afl_state_t *afl) {
#define SP10 SP5 SP5
#define SP20 SP10 SP10
+ /* Since `total_crashes` does not get reloaded from disk on restart,
+ it indicates if we found crashes this round already -> paint red.
+ If it's 0, but `unique_crashes` is set from a past run, paint in yellow. */
+ char *crash_color = afl->total_crashes ? cLRD
+ : afl->unique_crashes ? cYEL
+ : cRST;
+
/* Lord, forgive me this. */
SAYF(SET_G1 bSTG bLT bH bSTOP cCYA
@@ -732,7 +739,7 @@ void show_stats(afl_state_t *afl) {
u_stringify_time_diff(time_tmp, cur_ms, afl->last_crash_time);
SAYF(bV bSTOP " last uniq crash : " cRST "%-33s " bSTG bV bSTOP
" uniq crashes : %s%-6s" bSTG bV "\n",
- time_tmp, afl->unique_crashes ? cLRD : cRST, tmp);
+ time_tmp, crash_color, tmp);
sprintf(tmp, "%s%s", u_stringify_int(IB(0), afl->unique_hangs),
(afl->unique_hangs >= KEEP_UNIQUE_HANG) ? "+" : "");
@@ -815,20 +822,13 @@ void show_stats(afl_state_t *afl) {
SAYF(bV bSTOP " total execs : " cRST "%-20s " bSTG bV bSTOP
" new crashes : %s%-22s" bSTG bV "\n",
- u_stringify_int(IB(0), afl->fsrv.total_execs),
- afl->unique_crashes ? cLRD : cRST, tmp);
+ u_stringify_int(IB(0), afl->fsrv.total_execs), crash_color, tmp);
} else {
SAYF(bV bSTOP " total execs : " cRST "%-20s " bSTG bV bSTOP
" total crashes : %s%-22s" bSTG bV "\n",
- u_stringify_int(IB(0), afl->fsrv.total_execs),
- // New crashes this round -> Red, restored crashes -> yellow, else
- // white.
- afl->total_crashes ? cLRD
- : afl->unique_crashes ? cYEL
- : cRST,
- tmp);
+ u_stringify_int(IB(0), afl->fsrv.total_execs), crash_color, tmp);
}
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 7fe89c11..64e4b869 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -1597,8 +1597,8 @@ int main(int argc, char **argv_orig, char **envp) {
// only reinitialize when it makes sense
if ((map_size < new_map_size ||
- (new_map_size != MAP_SIZE && new_map_size < map_size &&
- map_size - new_map_size > MAP_SIZE))) {
+ (new_map_size != MAP_SIZE && new_map_size < map_size &&
+ map_size - new_map_size > MAP_SIZE))) {
OKF("Re-initializing maps to %u bytes", new_map_size);
@@ -1680,6 +1680,7 @@ int main(int argc, char **argv_orig, char **envp) {
setenv("AFL_NO_AUTODICT", "1", 1); // loaded already
afl->fsrv.trace_bits =
afl_shm_init(&afl->shm, new_map_size, afl->non_instrumented_mode);
+ afl->cmplog_fsrv.trace_bits = afl->fsrv.trace_bits;
afl_fsrv_start(&afl->fsrv, afl->argv, &afl->stop_soon,
afl->afl_env.afl_debug_child);
afl_fsrv_start(&afl->cmplog_fsrv, afl->argv, &afl->stop_soon,