custom mutator fix

This commit is contained in:
vanhauser-thc
2022-11-14 22:47:34 +01:00
parent 1cc2029179
commit e5c725c4e0
2 changed files with 92 additions and 84 deletions

View File

@ -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);