mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-13 02:28:09 +00:00
Merge pull request #458 from h1994st/dev
Allow the custom trim function to return 0 bytes
This commit is contained in:
@ -286,6 +286,15 @@ u8 trim_case_custom(afl_state_t *afl, struct queue_entry *q, u8 *in_buf,
|
|||||||
"Trimmed data returned by custom mutator is larger than original "
|
"Trimmed data returned by custom mutator is larger than original "
|
||||||
"data");
|
"data");
|
||||||
|
|
||||||
|
} else if (unlikely(retlen == 0)) {
|
||||||
|
|
||||||
|
/* Do not run the empty test case on the target. To keep the custom
|
||||||
|
trimming function running, we simply treat the empty test case as an
|
||||||
|
unsuccessful trimming and skip it, instead of aborting the trimming. */
|
||||||
|
|
||||||
|
++afl->trim_execs;
|
||||||
|
goto unsuccessful_trimming;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write_to_testcase(afl, retbuf, retlen);
|
write_to_testcase(afl, retbuf, retlen);
|
||||||
@ -325,6 +334,8 @@ u8 trim_case_custom(afl_state_t *afl, struct queue_entry *q, u8 *in_buf,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
unsuccessful_trimming:
|
||||||
|
|
||||||
/* Tell the custom mutator that the trimming was unsuccessful */
|
/* Tell the custom mutator that the trimming was unsuccessful */
|
||||||
afl->stage_cur = mutator->afl_custom_post_trim(mutator->data, 0);
|
afl->stage_cur = mutator->afl_custom_post_trim(mutator->data, 0);
|
||||||
if (unlikely(afl->stage_cur < 0)) {
|
if (unlikely(afl->stage_cur < 0)) {
|
||||||
|
Reference in New Issue
Block a user