mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-13 10:38:07 +00:00
custom mutator code enhancements and code-format
This commit is contained in:
@ -91,22 +91,22 @@ void write_to_testcase(afl_state_t *afl, void *mem, u32 len) {
|
||||
|
||||
if (unlikely(afl->custom_mutators_count)) {
|
||||
|
||||
u8 *new_buf = NULL;
|
||||
u8 * new_buf = NULL;
|
||||
ssize_t new_size = len;
|
||||
void * new_mem = mem;
|
||||
void * new_mem = mem;
|
||||
|
||||
LIST_FOREACH(&afl->custom_mutator_list, struct custom_mutator, {
|
||||
|
||||
if (el->afl_custom_pre_save) {
|
||||
new_size = el->afl_custom_pre_save(
|
||||
el->data, new_mem, new_size, &new_buf
|
||||
);
|
||||
|
||||
new_size =
|
||||
el->afl_custom_pre_save(el->data, new_mem, new_size, &new_buf);
|
||||
|
||||
}
|
||||
|
||||
new_mem = new_buf;
|
||||
|
||||
} );
|
||||
});
|
||||
|
||||
if (unlikely(!new_buf && (new_size <= 0))) {
|
||||
|
||||
@ -124,7 +124,6 @@ void write_to_testcase(afl_state_t *afl, void *mem, u32 len) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
/* boring uncustom. */
|
||||
@ -535,21 +534,22 @@ u8 trim_case(afl_state_t *afl, struct queue_entry *q, u8 *in_buf) {
|
||||
/* Custom mutator trimmer */
|
||||
if (afl->custom_mutators_count) {
|
||||
|
||||
u8 trimmed_case = 0;
|
||||
u8 trimmed_case = 0;
|
||||
bool custom_trimmed = false;
|
||||
|
||||
LIST_FOREACH(&afl->custom_mutator_list, struct custom_mutator, {
|
||||
|
||||
if (el->afl_custom_trim) {
|
||||
|
||||
|
||||
trimmed_case = trim_case_custom(afl, q, in_buf, el);
|
||||
custom_trimmed = true;
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
});
|
||||
|
||||
if (custom_trimmed) return trimmed_case;
|
||||
|
||||
|
||||
}
|
||||
|
||||
u8 needs_write = 0, fault = 0;
|
||||
|
Reference in New Issue
Block a user