aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2022-11-14 22:47:34 +0100
committervanhauser-thc <vh@thc.org>2022-11-14 22:47:34 +0100
commite5c725c4e0ccfbbff933aab0a3b833d4f21de470 (patch)
tree9a15fe02c66bd86faf55fbbc11f7ce56c7d20ae1 /src
parent1cc20291790b0c24f8c03447f89220c96dbdf733 (diff)
downloadafl++-e5c725c4e0ccfbbff933aab0a3b833d4f21de470.tar.gz
custom mutator fix
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz-run.c12
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);