diff options
author | vanhauser-thc <vh@thc.org> | 2022-11-14 22:47:34 +0100 |
---|---|---|
committer | vanhauser-thc <vh@thc.org> | 2022-11-14 22:47:34 +0100 |
commit | e5c725c4e0ccfbbff933aab0a3b833d4f21de470 (patch) | |
tree | 9a15fe02c66bd86faf55fbbc11f7ce56c7d20ae1 /src/afl-fuzz-run.c | |
parent | 1cc20291790b0c24f8c03447f89220c96dbdf733 (diff) | |
download | afl++-e5c725c4e0ccfbbff933aab0a3b833d4f21de470.tar.gz |
custom mutator fix
Diffstat (limited to 'src/afl-fuzz-run.c')
-rw-r--r-- | src/afl-fuzz-run.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c index a680228d..7f9c3bf3 100644 --- a/src/afl-fuzz-run.c +++ b/src/afl-fuzz-run.c @@ -76,6 +76,8 @@ fuzz_run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) { u32 __attribute__((hot)) write_to_testcase(afl_state_t *afl, void **mem, u32 len, u32 fix) { + u8 sent = 0; + if (unlikely(afl->custom_mutators_count)) { ssize_t new_size = len; @@ -140,12 +142,15 @@ write_to_testcase(afl_state_t *afl, void **mem, u32 len, u32 fix) { if (el->afl_custom_fuzz_send) { el->afl_custom_fuzz_send(el->data, *mem, new_size); + sent = 1; } }); - } else { + } + + if (likely(!sent)) { /* everything as planned. use the potentially new data. */ afl_fsrv_write_to_testcase(&afl->fsrv, *mem, new_size); @@ -172,12 +177,15 @@ write_to_testcase(afl_state_t *afl, void **mem, u32 len, u32 fix) { if (el->afl_custom_fuzz_send) { el->afl_custom_fuzz_send(el->data, *mem, len); + sent = 1; } }); - } else { + } + + if (likely(!sent)) { /* boring uncustom. */ afl_fsrv_write_to_testcase(&afl->fsrv, *mem, len); |