mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-15 03:18:07 +00:00
custom mutator fix
This commit is contained in:
@ -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);
|
||||
|
@ -3,10 +3,9 @@
|
||||
. ./test-pre.sh
|
||||
|
||||
$ECHO "$BLUE[*] Testing: custom mutator"
|
||||
test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
|
||||
# normalize path
|
||||
CUSTOM_MUTATOR_PATH=$(cd $(pwd)/../custom_mutators/examples;pwd)
|
||||
test -e test-custom-mutator.c -a -e ${CUSTOM_MUTATOR_PATH}/example.c -a -e ${CUSTOM_MUTATOR_PATH}/example.py && {
|
||||
# normalize path
|
||||
CUSTOM_MUTATOR_PATH=$(cd $(pwd)/../custom_mutators/examples;pwd)
|
||||
test -e test-custom-mutator.c -a -e ${CUSTOM_MUTATOR_PATH}/example.c -a -e ${CUSTOM_MUTATOR_PATH}/example.py && {
|
||||
unset AFL_CC
|
||||
# Compile the vulnerable program for single mutator
|
||||
test -e ../afl-clang-fast && {
|
||||
@ -74,7 +73,16 @@ test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
|
||||
|
||||
# Clean
|
||||
rm -rf out errors core.*
|
||||
} || {
|
||||
ls .
|
||||
ls ${CUSTOM_MUTATOR_PATH}
|
||||
$ECHO "$RED[!] cannot compile the test program or the custom mutator"
|
||||
CODE=1
|
||||
}
|
||||
}
|
||||
|
||||
test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
|
||||
test -e test-custom-mutator && {
|
||||
# Run afl-fuzz w/ the Python mutator
|
||||
$ECHO "$GREY[*] running afl-fuzz for the Python mutator, this will take approx 10 seconds"
|
||||
{
|
||||
@ -106,20 +114,12 @@ test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
|
||||
$ECHO "$RED[!] cannot compile the test program or the custom mutator"
|
||||
CODE=1
|
||||
}
|
||||
|
||||
#test "$CODE" = 1 && { $ECHO "$YELLOW[!] custom mutator tests currently will not fail travis" ; CODE=0 ; }
|
||||
|
||||
make -C ../utils/custom_mutators clean > /dev/null 2>&1
|
||||
rm -f test-custom-mutator
|
||||
rm -f test-custom-mutators
|
||||
} || {
|
||||
$ECHO "$YELLOW[-] no custom mutators in $CUSTOM_MUTATOR_PATH, cannot test"
|
||||
INCOMPLETE=1
|
||||
}
|
||||
unset CUSTOM_MUTATOR_PATH
|
||||
} || {
|
||||
$ECHO "$YELLOW[-] no python support in afl-fuzz, cannot test"
|
||||
INCOMPLETE=1
|
||||
}
|
||||
|
||||
make -C ../utils/custom_mutators clean > /dev/null 2>&1
|
||||
rm -f test-custom-mutator test-custom-mutators
|
||||
|
||||
. ./test-post.sh
|
||||
|
Reference in New Issue
Block a user