mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 19:08:08 +00:00
fix
This commit is contained in:
@ -76,24 +76,6 @@ 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) {
|
||||
|
||||
#ifdef _AFL_DOCUMENT_MUTATIONS
|
||||
s32 doc_fd;
|
||||
char fn[PATH_MAX];
|
||||
snprintf(fn, PATH_MAX, "%s/mutations/%09u:%s", afl->out_dir,
|
||||
afl->document_counter++,
|
||||
describe_op(afl, 0, NAME_MAX - strlen("000000000:")));
|
||||
|
||||
if ((doc_fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, DEFAULT_PERMISSION)) >=
|
||||
0) {
|
||||
|
||||
if (write(doc_fd, *mem, len) != len)
|
||||
PFATAL("write to mutation file failed: %s", fn);
|
||||
close(doc_fd);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (unlikely(afl->custom_mutators_count)) {
|
||||
|
||||
ssize_t new_size = len;
|
||||
@ -172,6 +154,25 @@ write_to_testcase(afl_state_t *afl, void **mem, u32 len, u32 fix) {
|
||||
|
||||
}
|
||||
|
||||
#ifdef _AFL_DOCUMENT_MUTATIONS
|
||||
s32 doc_fd;
|
||||
char fn[PATH_MAX];
|
||||
snprintf(fn, PATH_MAX, "%s/mutations/%09u:%s", afl->out_dir,
|
||||
afl->document_counter++,
|
||||
describe_op(afl, 0, NAME_MAX - strlen("000000000:")));
|
||||
|
||||
if ((doc_fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, DEFAULT_PERMISSION)) >=
|
||||
0) {
|
||||
|
||||
if (write(doc_fd, *mem, len) != len)
|
||||
PFATAL("write to mutation file failed: %s", fn);
|
||||
close(doc_fd);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "len = %u\n", len);
|
||||
return len;
|
||||
|
||||
}
|
||||
@ -992,7 +993,7 @@ common_fuzz_stuff(afl_state_t *afl, u8 *out_buf, u32 len) {
|
||||
|
||||
u8 fault;
|
||||
|
||||
if (unlikely(len = write_to_testcase(afl, (void **)&out_buf, len, 0) == 0)) {
|
||||
if (unlikely(len = write_to_testcase(afl, (void **)&out_buf, len, 0)) == 0) {
|
||||
|
||||
return 0;
|
||||
|
||||
|
Reference in New Issue
Block a user