diff options
author | van Hauser <vh@thc.org> | 2023-04-26 16:33:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 16:33:42 +0200 |
commit | 7ca1b85c5e8229fa49620d0fb542c86965ef5abb (patch) | |
tree | 49357cab6a9fea70f30f43b129b02434772f5e66 /src/afl-fuzz-init.c | |
parent | dbb317162415a28e3fd2ff4c574292c924493a00 (diff) | |
parent | b18bc7b98fa23ef805ed2ee3eec04dc1929afd49 (diff) | |
download | afl++-7ca1b85c5e8229fa49620d0fb542c86965ef5abb.tar.gz |
Merge pull request #1715 from AFLplusplus/dev
push to stable
Diffstat (limited to 'src/afl-fuzz-init.c')
-rw-r--r-- | src/afl-fuzz-init.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index 01d1e82e..bd591c8f 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -718,10 +718,21 @@ void read_testcases(afl_state_t *afl, u8 *directory) { if (nl_cnt) { - i = nl_cnt; + u32 done = 0; + + if (unlikely(afl->in_place_resume)) { + + i = nl_cnt; + + } else { + + i = 0; + + } + do { - --i; + if (unlikely(afl->in_place_resume)) { --i; } struct stat st; u8 dfn[PATH_MAX]; @@ -745,7 +756,7 @@ void read_testcases(afl_state_t *afl, u8 *directory) { free(nl[i]); /* not tracked */ read_testcases(afl, fn2); ck_free(fn2); - continue; + goto next_entry; } @@ -754,7 +765,7 @@ void read_testcases(afl_state_t *afl, u8 *directory) { if (!S_ISREG(st.st_mode) || !st.st_size || strstr(fn2, "/README.txt")) { ck_free(fn2); - continue; + goto next_entry; } @@ -801,18 +812,18 @@ void read_testcases(afl_state_t *afl, u8 *directory) { } - /* - if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE)) { + next_entry: + if (unlikely(afl->in_place_resume)) { - u64 cksum = hash64(afl->fsrv.trace_bits, afl->fsrv.map_size, - HASH_CONST); afl->queue_top->n_fuzz_entry = cksum % N_FUZZ_SIZE; - afl->n_fuzz[afl->queue_top->n_fuzz_entry] = 1; + if (unlikely(i == 0)) { done = 1; } - } + } else { + + if (unlikely(++i >= (u32)nl_cnt)) { done = 1; } - */ + } - } while (i > 0); + } while (!done); } |