diff options
author | van Hauser <vh@thc.org> | 2020-07-21 13:17:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-21 13:17:29 +0200 |
commit | 9a33a29b4a87ec9f211f83fa83f499e1ed8c256d (patch) | |
tree | 2c0d6c7c128fbadd145b5df91c917a75483f3be6 /src | |
parent | b6e65f98827470745d7df5cf1e38b506b9e839b0 (diff) | |
parent | 6c163910eec79058bdaf3a358e75d579da1f9112 (diff) | |
download | afl++-9a33a29b4a87ec9f211f83fa83f499e1ed8c256d.tar.gz |
Merge pull request #462 from AFLplusplus/dev
Dev
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-fuzz-mutators.c | 11 | ||||
-rw-r--r-- | src/afl-fuzz.c | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/afl-fuzz-mutators.c b/src/afl-fuzz-mutators.c index 9fc77ffe..0fb34ab7 100644 --- a/src/afl-fuzz-mutators.c +++ b/src/afl-fuzz-mutators.c @@ -286,6 +286,15 @@ u8 trim_case_custom(afl_state_t *afl, struct queue_entry *q, u8 *in_buf, "Trimmed data returned by custom mutator is larger than original " "data"); + } else if (unlikely(retlen == 0)) { + + /* Do not run the empty test case on the target. To keep the custom + trimming function running, we simply treat the empty test case as an + unsuccessful trimming and skip it, instead of aborting the trimming. */ + + ++afl->trim_execs; + goto unsuccessful_trimming; + } write_to_testcase(afl, retbuf, retlen); @@ -325,6 +334,8 @@ u8 trim_case_custom(afl_state_t *afl, struct queue_entry *q, u8 *in_buf, } else { + unsuccessful_trimming: + /* Tell the custom mutator that the trimming was unsuccessful */ afl->stage_cur = mutator->afl_custom_post_trim(mutator->data, 0); if (unlikely(afl->stage_cur < 0)) { diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 872ed9ae..df2896d2 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -1048,6 +1048,12 @@ int main(int argc, char **argv_orig, char **envp) { } + #ifdef RAND_TEST_VALUES + u32 counter; + for (counter = 0; counter < 100000; counter++) + printf("DEBUG: rand %06d is %u\n", counter, rand_below(afl, 65536)); + #endif + setup_custom_mutators(afl); setup_cmdline_file(afl, argv + optind); |