about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
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);