mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
honor afl_quiet on env var checks + code-format
This commit is contained in:
@ -77,10 +77,10 @@
|
|||||||
/* The actual postprocessor routine called by afl-fuzz: */
|
/* The actual postprocessor routine called by afl-fuzz: */
|
||||||
|
|
||||||
const unsigned char *afl_postprocess(const unsigned char *in_buf,
|
const unsigned char *afl_postprocess(const unsigned char *in_buf,
|
||||||
unsigned int *len) {
|
unsigned int * len) {
|
||||||
|
|
||||||
static unsigned char *saved_buf;
|
static unsigned char *saved_buf;
|
||||||
unsigned char *new_buf;
|
unsigned char * new_buf;
|
||||||
|
|
||||||
/* Skip execution altogether for buffers shorter than 6 bytes (just to
|
/* Skip execution altogether for buffers shorter than 6 bytes (just to
|
||||||
show how it's done). We can trust *len to be sane. */
|
show how it's done). We can trust *len to be sane. */
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static u8 *obj_path; /* Path to runtime libraries */
|
static u8 * obj_path; /* Path to runtime libraries */
|
||||||
static u8 **cc_params; /* Parameters passed to the real CC */
|
static u8 **cc_params; /* Parameters passed to the real CC */
|
||||||
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
|
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
|
||||||
u8 use_stdin = 0; /* dummy */
|
u8 use_stdin = 0; /* dummy */
|
||||||
|
@ -86,7 +86,7 @@ static void __afl_map_shm(void) {
|
|||||||
if (id_str) {
|
if (id_str) {
|
||||||
|
|
||||||
#ifdef USEMMAP
|
#ifdef USEMMAP
|
||||||
const char *shm_file_path = id_str;
|
const char * shm_file_path = id_str;
|
||||||
int shm_fd = -1;
|
int shm_fd = -1;
|
||||||
unsigned char *shm_base = NULL;
|
unsigned char *shm_base = NULL;
|
||||||
|
|
||||||
|
@ -284,14 +284,14 @@ enum {
|
|||||||
|
|
||||||
typedef struct MOpt_globals {
|
typedef struct MOpt_globals {
|
||||||
|
|
||||||
u64 *finds;
|
u64 * finds;
|
||||||
u64 *finds_v2;
|
u64 * finds_v2;
|
||||||
u64 *cycles;
|
u64 * cycles;
|
||||||
u64 *cycles_v2;
|
u64 * cycles_v2;
|
||||||
u64 *cycles_v3;
|
u64 * cycles_v3;
|
||||||
u32 is_pilot_mode;
|
u32 is_pilot_mode;
|
||||||
u64 *pTime;
|
u64 * pTime;
|
||||||
u64 period;
|
u64 period;
|
||||||
char *havoc_stagename;
|
char *havoc_stagename;
|
||||||
char *splice_stageformat;
|
char *splice_stageformat;
|
||||||
char *havoc_stagenameshort;
|
char *havoc_stagenameshort;
|
||||||
@ -548,7 +548,7 @@ extern list_t afl_states;
|
|||||||
struct custom_mutator {
|
struct custom_mutator {
|
||||||
|
|
||||||
const char *name;
|
const char *name;
|
||||||
void *dh;
|
void * dh;
|
||||||
|
|
||||||
/* hooks for the custom mutator function */
|
/* hooks for the custom mutator function */
|
||||||
|
|
||||||
@ -696,8 +696,8 @@ struct custom_mutator {
|
|||||||
* argument can be NULL while initializing the fuzzer
|
* argument can be NULL while initializing the fuzzer
|
||||||
*/
|
*/
|
||||||
void (*afl_custom_queue_new_entry)(afl_state_t *afl,
|
void (*afl_custom_queue_new_entry)(afl_state_t *afl,
|
||||||
const u8 *filename_new_queue,
|
const u8 * filename_new_queue,
|
||||||
const u8 *filename_orig_queue);
|
const u8 * filename_orig_queue);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ typedef struct list_element {
|
|||||||
|
|
||||||
struct list_element *prev;
|
struct list_element *prev;
|
||||||
struct list_element *next;
|
struct list_element *next;
|
||||||
void *data;
|
void * data;
|
||||||
|
|
||||||
} element_t;
|
} element_t;
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ static void list_append(list_t *list, void *el) {
|
|||||||
#define LIST_FOREACH(list, type, block) \
|
#define LIST_FOREACH(list, type, block) \
|
||||||
do { \
|
do { \
|
||||||
\
|
\
|
||||||
list_t *li = (list); \
|
list_t * li = (list); \
|
||||||
element_t *head = get_head((li)); \
|
element_t *head = get_head((li)); \
|
||||||
element_t *el_box = (head)->next; \
|
element_t *el_box = (head)->next; \
|
||||||
if (!el_box) FATAL("foreach over uninitialized list"); \
|
if (!el_box) FATAL("foreach over uninitialized list"); \
|
||||||
|
@ -163,7 +163,7 @@ static u32 alloc_canary;
|
|||||||
|
|
||||||
static void *__dislocator_alloc(size_t len) {
|
static void *__dislocator_alloc(size_t len) {
|
||||||
|
|
||||||
u8 *ret;
|
u8 * ret;
|
||||||
size_t tlen;
|
size_t tlen;
|
||||||
int flags, fd, sp;
|
int flags, fd, sp;
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ void free(void *ptr) {
|
|||||||
|
|
||||||
if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) {
|
if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) {
|
||||||
|
|
||||||
u8 *ptr_ = ptr;
|
u8 * ptr_ = ptr;
|
||||||
size_t rlen = (len & ~(ALLOC_ALIGN_SIZE - 1)) + ALLOC_ALIGN_SIZE;
|
size_t rlen = (len & ~(ALLOC_ALIGN_SIZE - 1)) + ALLOC_ALIGN_SIZE;
|
||||||
for (; len < rlen; ++len)
|
for (; len < rlen; ++len)
|
||||||
if (ptr_[len] != TAIL_ALLOC_CANARY)
|
if (ptr_[len] != TAIL_ALLOC_CANARY)
|
||||||
@ -451,7 +451,7 @@ void *reallocarray(void *ptr, size_t elem_len, size_t elem_cnt) {
|
|||||||
|
|
||||||
const size_t elem_lim = 1UL << (sizeof(size_t) * 4);
|
const size_t elem_lim = 1UL << (sizeof(size_t) * 4);
|
||||||
const size_t elem_tot = elem_len * elem_cnt;
|
const size_t elem_tot = elem_len * elem_cnt;
|
||||||
void *ret = NULL;
|
void * ret = NULL;
|
||||||
|
|
||||||
if ((elem_len >= elem_lim || elem_cnt >= elem_lim) && elem_len > 0 &&
|
if ((elem_len >= elem_lim || elem_cnt >= elem_lim) && elem_len > 0 &&
|
||||||
elem_cnt > (SIZE_MAX / elem_len)) {
|
elem_cnt > (SIZE_MAX / elem_len)) {
|
||||||
|
@ -160,7 +160,7 @@ static void __tokencap_load_mappings(void) {
|
|||||||
int mib[] = {CTL_VM, VM_PROC, VM_PROC_MAP, __tokencap_pid,
|
int mib[] = {CTL_VM, VM_PROC, VM_PROC_MAP, __tokencap_pid,
|
||||||
sizeof(struct kinfo_vmentry)};
|
sizeof(struct kinfo_vmentry)};
|
||||||
#endif
|
#endif
|
||||||
char *buf, *low, *high;
|
char * buf, *low, *high;
|
||||||
size_t miblen = sizeof(mib) / sizeof(mib[0]);
|
size_t miblen = sizeof(mib) / sizeof(mib[0]);
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
static u8 *obj_path; /* Path to runtime libraries */
|
static u8 * obj_path; /* Path to runtime libraries */
|
||||||
static u8 **cc_params; /* Parameters passed to the real CC */
|
static u8 **cc_params; /* Parameters passed to the real CC */
|
||||||
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
|
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
|
||||||
static u8 llvm_fullpath[PATH_MAX];
|
static u8 llvm_fullpath[PATH_MAX];
|
||||||
static u8 lto_mode;
|
static u8 lto_mode;
|
||||||
static u8 *lto_flag = AFL_CLANG_FLTO;
|
static u8 * lto_flag = AFL_CLANG_FLTO;
|
||||||
static u8 *march_opt = CFLAGS_OPT;
|
static u8 * march_opt = CFLAGS_OPT;
|
||||||
static u8 debug;
|
static u8 debug;
|
||||||
static u8 cwd[4096];
|
static u8 cwd[4096];
|
||||||
static u8 cmplog_mode;
|
static u8 cmplog_mode;
|
||||||
|
@ -78,7 +78,7 @@ static u32 ld_param_cnt = 1, /* Number of params to 'ld' */
|
|||||||
/* This function wipes a directory - our AR unpack directory in this case */
|
/* This function wipes a directory - our AR unpack directory in this case */
|
||||||
static u8 wipe_directory(u8 *path) {
|
static u8 wipe_directory(u8 *path) {
|
||||||
|
|
||||||
DIR *d;
|
DIR * d;
|
||||||
struct dirent *d_ent;
|
struct dirent *d_ent;
|
||||||
|
|
||||||
d = opendir(path);
|
d = opendir(path);
|
||||||
@ -328,12 +328,12 @@ static void edit_params(int argc, char **argv) {
|
|||||||
// where the same "foo.o" was in both .a archives. llvm-link does not
|
// where the same "foo.o" was in both .a archives. llvm-link does not
|
||||||
// like this so we have to work around that ...
|
// like this so we have to work around that ...
|
||||||
|
|
||||||
u8 this_wd[4096], *this_ar;
|
u8 this_wd[4096], *this_ar;
|
||||||
u8 ar_params_cnt = 4;
|
u8 ar_params_cnt = 4;
|
||||||
u8 *ar_params[ar_params_cnt];
|
u8 * ar_params[ar_params_cnt];
|
||||||
u8 *file = argv[i];
|
u8 * file = argv[i];
|
||||||
s32 pid, status;
|
s32 pid, status;
|
||||||
DIR *arx;
|
DIR * arx;
|
||||||
struct dirent *dir_ent;
|
struct dirent *dir_ent;
|
||||||
|
|
||||||
if (libdir_index < libdir_cnt) file = libdir_file;
|
if (libdir_index < libdir_cnt) file = libdir_file;
|
||||||
|
@ -89,8 +89,8 @@ static void __afl_map_shm(void) {
|
|||||||
if (id_str) {
|
if (id_str) {
|
||||||
|
|
||||||
#ifdef USEMMAP
|
#ifdef USEMMAP
|
||||||
const char *shm_file_path = id_str;
|
const char * shm_file_path = id_str;
|
||||||
int shm_fd = -1;
|
int shm_fd = -1;
|
||||||
unsigned char *shm_base = NULL;
|
unsigned char *shm_base = NULL;
|
||||||
|
|
||||||
/* create the shared memory segment as if it was a file */
|
/* create the shared memory segment as if it was a file */
|
||||||
@ -137,8 +137,8 @@ static void __afl_map_shm(void) {
|
|||||||
if (id_str) {
|
if (id_str) {
|
||||||
|
|
||||||
#ifdef USEMMAP
|
#ifdef USEMMAP
|
||||||
const char *shm_file_path = id_str;
|
const char * shm_file_path = id_str;
|
||||||
int shm_fd = -1;
|
int shm_fd = -1;
|
||||||
unsigned char *shm_base = NULL;
|
unsigned char *shm_base = NULL;
|
||||||
|
|
||||||
/* create the shared memory segment as if it was a file */
|
/* create the shared memory segment as if it was a file */
|
||||||
|
@ -130,7 +130,7 @@ static void __compcov_load(void) {
|
|||||||
char *bin_name = getenv("AFL_COMPCOV_BINNAME");
|
char *bin_name = getenv("AFL_COMPCOV_BINNAME");
|
||||||
|
|
||||||
procmaps_iterator *maps = pmparser_parse(-1);
|
procmaps_iterator *maps = pmparser_parse(-1);
|
||||||
procmaps_struct *maps_tmp = NULL;
|
procmaps_struct * maps_tmp = NULL;
|
||||||
|
|
||||||
while ((maps_tmp = pmparser_next(maps)) != NULL) {
|
while ((maps_tmp = pmparser_next(maps)) != NULL) {
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ implied warranty.
|
|||||||
*/
|
*/
|
||||||
typedef struct procmaps_struct {
|
typedef struct procmaps_struct {
|
||||||
|
|
||||||
void *addr_start; //< start address of the area
|
void * addr_start; //< start address of the area
|
||||||
void *addr_end; //< end address
|
void * addr_end; //< end address
|
||||||
unsigned long length; //< size of the range
|
unsigned long length; //< size of the range
|
||||||
|
|
||||||
char perm[5]; //< permissions rwxp
|
char perm[5]; //< permissions rwxp
|
||||||
|
@ -824,7 +824,7 @@ static void usage(u8 *argv0) {
|
|||||||
|
|
||||||
static void find_binary(u8 *fname) {
|
static void find_binary(u8 *fname) {
|
||||||
|
|
||||||
u8 *env_path = 0;
|
u8 * env_path = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (strchr(fname, '/') || !(env_path = getenv("PATH"))) {
|
if (strchr(fname, '/') || !(env_path = getenv("PATH"))) {
|
||||||
|
@ -44,7 +44,7 @@ void detect_file_args(char **argv, u8 *prog_in, u8 *use_stdin) {
|
|||||||
#ifdef __GLIBC__
|
#ifdef __GLIBC__
|
||||||
u8 *cwd = getcwd(NULL, 0); /* non portable glibc extension */
|
u8 *cwd = getcwd(NULL, 0); /* non portable glibc extension */
|
||||||
#else
|
#else
|
||||||
u8 *cwd;
|
u8 * cwd;
|
||||||
char *buf;
|
char *buf;
|
||||||
long size = pathconf(".", _PC_PATH_MAX);
|
long size = pathconf(".", _PC_PATH_MAX);
|
||||||
if ((buf = (char *)malloc((size_t)size)) != NULL) {
|
if ((buf = (char *)malloc((size_t)size)) != NULL) {
|
||||||
@ -151,7 +151,7 @@ void argv_cpy_free(char **argv) {
|
|||||||
char **get_qemu_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
|
char **get_qemu_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
|
||||||
|
|
||||||
char **new_argv = ck_alloc(sizeof(char *) * (argc + 4));
|
char **new_argv = ck_alloc(sizeof(char *) * (argc + 4));
|
||||||
u8 *tmp, *cp = NULL, *rsl, *own_copy;
|
u8 * tmp, *cp = NULL, *rsl, *own_copy;
|
||||||
|
|
||||||
memcpy(new_argv + 3, argv + 1, (int)(sizeof(char *)) * argc);
|
memcpy(new_argv + 3, argv + 1, (int)(sizeof(char *)) * argc);
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ char **get_qemu_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
|
|||||||
char **get_wine_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
|
char **get_wine_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
|
||||||
|
|
||||||
char **new_argv = ck_alloc(sizeof(char *) * (argc + 3));
|
char **new_argv = ck_alloc(sizeof(char *) * (argc + 3));
|
||||||
u8 *tmp, *cp = NULL, *rsl, *own_copy;
|
u8 * tmp, *cp = NULL, *rsl, *own_copy;
|
||||||
|
|
||||||
memcpy(new_argv + 2, argv + 1, (int)(sizeof(char *)) * argc);
|
memcpy(new_argv + 2, argv + 1, (int)(sizeof(char *)) * argc);
|
||||||
|
|
||||||
@ -324,6 +324,8 @@ char **get_wine_argv(u8 *own_loc, u8 **target_path_p, int argc, char **argv) {
|
|||||||
|
|
||||||
void check_environment_vars(char **envp) {
|
void check_environment_vars(char **envp) {
|
||||||
|
|
||||||
|
if (be_quiet) return;
|
||||||
|
|
||||||
int index = 0, found = 0;
|
int index = 0, found = 0;
|
||||||
char *env;
|
char *env;
|
||||||
while ((env = envp[index++]) != NULL) {
|
while ((env = envp[index++]) != NULL) {
|
||||||
|
@ -461,8 +461,8 @@ u8 *describe_op(afl_state_t *afl, u8 hnb) {
|
|||||||
|
|
||||||
static void write_crash_readme(afl_state_t *afl) {
|
static void write_crash_readme(afl_state_t *afl) {
|
||||||
|
|
||||||
u8 *fn = alloc_printf("%s/crashes/README.txt", afl->out_dir);
|
u8 * fn = alloc_printf("%s/crashes/README.txt", afl->out_dir);
|
||||||
s32 fd;
|
s32 fd;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
fd = open(fn, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
fd = open(fn, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
||||||
|
@ -51,9 +51,9 @@ void load_extras_file(afl_state_t *afl, u8 *fname, u32 *min_len, u32 *max_len,
|
|||||||
u32 dict_level) {
|
u32 dict_level) {
|
||||||
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
u8 buf[MAX_LINE];
|
u8 buf[MAX_LINE];
|
||||||
u8 *lptr;
|
u8 * lptr;
|
||||||
u32 cur_line = 0;
|
u32 cur_line = 0;
|
||||||
|
|
||||||
f = fopen(fname, "r");
|
f = fopen(fname, "r");
|
||||||
|
|
||||||
@ -188,10 +188,10 @@ void load_extras_file(afl_state_t *afl, u8 *fname, u32 *min_len, u32 *max_len,
|
|||||||
|
|
||||||
void load_extras(afl_state_t *afl, u8 *dir) {
|
void load_extras(afl_state_t *afl, u8 *dir) {
|
||||||
|
|
||||||
DIR *d;
|
DIR * d;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
u32 min_len = MAX_DICT_FILE, max_len = 0, dict_level = 0;
|
u32 min_len = MAX_DICT_FILE, max_len = 0, dict_level = 0;
|
||||||
u8 *x;
|
u8 * x;
|
||||||
|
|
||||||
/* If the name ends with @, extract level and continue. */
|
/* If the name ends with @, extract level and continue. */
|
||||||
|
|
||||||
@ -224,8 +224,8 @@ void load_extras(afl_state_t *afl, u8 *dir) {
|
|||||||
while ((de = readdir(d))) {
|
while ((de = readdir(d))) {
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
u8 *fn = alloc_printf("%s/%s", dir, de->d_name);
|
u8 * fn = alloc_printf("%s/%s", dir, de->d_name);
|
||||||
s32 fd;
|
s32 fd;
|
||||||
|
|
||||||
if (lstat(fn, &st) || access(fn, R_OK)) PFATAL("Unable to access '%s'", fn);
|
if (lstat(fn, &st) || access(fn, R_OK)) PFATAL("Unable to access '%s'", fn);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
|
|||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
cpu_set_t c;
|
cpu_set_t c;
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
cpuset_t *c;
|
cpuset_t * c;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u8 cpu_used[4096] = {0};
|
u8 cpu_used[4096] = {0};
|
||||||
@ -51,7 +51,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
DIR *d;
|
DIR * d;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
d = opendir("/proc");
|
d = opendir("/proc");
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
|
|||||||
|
|
||||||
while ((de = readdir(d))) {
|
while ((de = readdir(d))) {
|
||||||
|
|
||||||
u8 *fn;
|
u8 * fn;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
u8 tmp[MAX_LINE];
|
u8 tmp[MAX_LINE];
|
||||||
u8 has_vmsize = 0;
|
u8 has_vmsize = 0;
|
||||||
@ -275,8 +275,8 @@ cpuset_destroy(c);
|
|||||||
void setup_post(afl_state_t *afl) {
|
void setup_post(afl_state_t *afl) {
|
||||||
|
|
||||||
void *dh;
|
void *dh;
|
||||||
u8 *fn = get_afl_env("AFL_POST_LIBRARY");
|
u8 * fn = get_afl_env("AFL_POST_LIBRARY");
|
||||||
u32 tlen = 6;
|
u32 tlen = 6;
|
||||||
|
|
||||||
if (!fn) return;
|
if (!fn) return;
|
||||||
|
|
||||||
@ -319,9 +319,9 @@ static void shuffle_ptrs(afl_state_t *afl, void **ptrs, u32 cnt) {
|
|||||||
void read_testcases(afl_state_t *afl) {
|
void read_testcases(afl_state_t *afl) {
|
||||||
|
|
||||||
struct dirent **nl;
|
struct dirent **nl;
|
||||||
s32 nl_cnt;
|
s32 nl_cnt;
|
||||||
u32 i;
|
u32 i;
|
||||||
u8 *fn1;
|
u8 * fn1;
|
||||||
|
|
||||||
/* Auto-detect non-in-place resumption attempts. */
|
/* Auto-detect non-in-place resumption attempts. */
|
||||||
|
|
||||||
@ -447,8 +447,8 @@ static void check_map_coverage(afl_state_t *afl) {
|
|||||||
void perform_dry_run(afl_state_t *afl) {
|
void perform_dry_run(afl_state_t *afl) {
|
||||||
|
|
||||||
struct queue_entry *q = afl->queue;
|
struct queue_entry *q = afl->queue;
|
||||||
u32 cal_failures = 0;
|
u32 cal_failures = 0;
|
||||||
u8 *skip_crashes = get_afl_env("AFL_SKIP_CRASHES");
|
u8 * skip_crashes = get_afl_env("AFL_SKIP_CRASHES");
|
||||||
|
|
||||||
while (q) {
|
while (q) {
|
||||||
|
|
||||||
@ -872,7 +872,7 @@ void find_timeout(afl_state_t *afl) {
|
|||||||
|
|
||||||
static u8 delete_files(u8 *path, u8 *prefix) {
|
static u8 delete_files(u8 *path, u8 *prefix) {
|
||||||
|
|
||||||
DIR *d;
|
DIR * d;
|
||||||
struct dirent *d_ent;
|
struct dirent *d_ent;
|
||||||
|
|
||||||
d = opendir(path);
|
d = opendir(path);
|
||||||
@ -997,7 +997,7 @@ dir_cleanup_failed:
|
|||||||
static void handle_existing_out_dir(afl_state_t *afl) {
|
static void handle_existing_out_dir(afl_state_t *afl) {
|
||||||
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
u8 *fn = alloc_printf("%s/fuzzer_stats", afl->out_dir);
|
u8 * fn = alloc_printf("%s/fuzzer_stats", afl->out_dir);
|
||||||
|
|
||||||
/* See if the output directory is locked. If yes, bail out. If not,
|
/* See if the output directory is locked. If yes, bail out. If not,
|
||||||
create a lock that will persist for the lifetime of the process
|
create a lock that will persist for the lifetime of the process
|
||||||
@ -1851,7 +1851,7 @@ static void handle_skipreq(int sig) {
|
|||||||
|
|
||||||
void check_binary(afl_state_t *afl, u8 *fname) {
|
void check_binary(afl_state_t *afl, u8 *fname) {
|
||||||
|
|
||||||
u8 *env_path = 0;
|
u8 * env_path = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
|
@ -216,7 +216,7 @@ u8 trim_case_custom(afl_state_t *afl, struct queue_entry *q, u8 *in_buf) {
|
|||||||
|
|
||||||
u32 cksum;
|
u32 cksum;
|
||||||
|
|
||||||
u8 *retbuf = NULL;
|
u8 * retbuf = NULL;
|
||||||
size_t retlen = 0;
|
size_t retlen = 0;
|
||||||
|
|
||||||
afl->mutator->afl_custom_trim(afl, &retbuf, &retlen);
|
afl->mutator->afl_custom_trim(afl, &retbuf, &retlen);
|
||||||
|
@ -1566,8 +1566,8 @@ custom_mutator_stage:
|
|||||||
for (afl->stage_cur = 0; afl->stage_cur < afl->stage_max; ++afl->stage_cur) {
|
for (afl->stage_cur = 0; afl->stage_cur < afl->stage_max; ++afl->stage_cur) {
|
||||||
|
|
||||||
struct queue_entry *target;
|
struct queue_entry *target;
|
||||||
u32 tid;
|
u32 tid;
|
||||||
u8 *new_buf;
|
u8 * new_buf;
|
||||||
|
|
||||||
retry_external_pick:
|
retry_external_pick:
|
||||||
/* Pick a random other queue entry for passing to external API */
|
/* Pick a random other queue entry for passing to external API */
|
||||||
@ -2163,9 +2163,9 @@ retry_splicing:
|
|||||||
afl->queued_paths > 1 && afl->queue_cur->len > 1) {
|
afl->queued_paths > 1 && afl->queue_cur->len > 1) {
|
||||||
|
|
||||||
struct queue_entry *target;
|
struct queue_entry *target;
|
||||||
u32 tid, split_at;
|
u32 tid, split_at;
|
||||||
u8 *new_buf;
|
u8 * new_buf;
|
||||||
s32 f_diff, l_diff;
|
s32 f_diff, l_diff;
|
||||||
|
|
||||||
/* First of all, if we've modified in_buf for havoc, let's clean that
|
/* First of all, if we've modified in_buf for havoc, let's clean that
|
||||||
up... */
|
up... */
|
||||||
|
@ -43,7 +43,7 @@ int init_py_module(afl_state_t *afl, u8 *module_name) {
|
|||||||
afl->py_module = PyImport_Import(py_name);
|
afl->py_module = PyImport_Import(py_name);
|
||||||
Py_DECREF(py_name);
|
Py_DECREF(py_name);
|
||||||
|
|
||||||
PyObject *py_module = afl->py_module;
|
PyObject * py_module = afl->py_module;
|
||||||
PyObject **py_functions = afl->py_functions;
|
PyObject **py_functions = afl->py_functions;
|
||||||
|
|
||||||
if (afl->py_module != NULL) {
|
if (afl->py_module != NULL) {
|
||||||
|
@ -347,9 +347,9 @@ void show_stats(afl_state_t *afl) {
|
|||||||
|
|
||||||
/* Lord, forgive me this. */
|
/* Lord, forgive me this. */
|
||||||
|
|
||||||
SAYF(SET_G1 bSTG bLT bH bSTOP cCYA
|
SAYF(SET_G1 bSTG bLT bH bSTOP cCYA
|
||||||
" process timing " bSTG bH30 bH5 bH bHB bH bSTOP cCYA
|
" process timing " bSTG bH30 bH5 bH bHB bH bSTOP cCYA
|
||||||
" overall results " bSTG bH2 bH2 bRT "\n");
|
" overall results " bSTG bH2 bH2 bRT "\n");
|
||||||
|
|
||||||
if (afl->dumb_mode) {
|
if (afl->dumb_mode) {
|
||||||
|
|
||||||
@ -429,9 +429,9 @@ void show_stats(afl_state_t *afl) {
|
|||||||
" uniq hangs : " cRST "%-6s" bSTG bV "\n",
|
" uniq hangs : " cRST "%-6s" bSTG bV "\n",
|
||||||
DTD(cur_ms, afl->last_hang_time), tmp);
|
DTD(cur_ms, afl->last_hang_time), tmp);
|
||||||
|
|
||||||
SAYF(bVR bH bSTOP cCYA
|
SAYF(bVR bH bSTOP cCYA
|
||||||
" cycle progress " bSTG bH10 bH5 bH2 bH2 bHB bH bSTOP cCYA
|
" cycle progress " bSTG bH10 bH5 bH2 bH2 bHB bH bSTOP cCYA
|
||||||
" map coverage " bSTG bH bHT bH20 bH2 bVL "\n");
|
" map coverage " bSTG bH bHT bH20 bH2 bVL "\n");
|
||||||
|
|
||||||
/* This gets funny because we want to print several variable-length variables
|
/* This gets funny because we want to print several variable-length variables
|
||||||
together, but then cram them into a fixed-width field - so we need to
|
together, but then cram them into a fixed-width field - so we need to
|
||||||
@ -460,9 +460,9 @@ void show_stats(afl_state_t *afl) {
|
|||||||
|
|
||||||
SAYF(bSTOP " count coverage : " cRST "%-21s" bSTG bV "\n", tmp);
|
SAYF(bSTOP " count coverage : " cRST "%-21s" bSTG bV "\n", tmp);
|
||||||
|
|
||||||
SAYF(bVR bH bSTOP cCYA
|
SAYF(bVR bH bSTOP cCYA
|
||||||
" stage progress " bSTG bH10 bH5 bH2 bH2 bX bH bSTOP cCYA
|
" stage progress " bSTG bH10 bH5 bH2 bH2 bX bH bSTOP cCYA
|
||||||
" findings in depth " bSTG bH10 bH5 bH2 bH2 bVL "\n");
|
" findings in depth " bSTG bH10 bH5 bH2 bH2 bVL "\n");
|
||||||
|
|
||||||
sprintf(tmp, "%s (%0.02f%%)", DI(afl->queued_favored),
|
sprintf(tmp, "%s (%0.02f%%)", DI(afl->queued_favored),
|
||||||
((double)afl->queued_favored) * 100 / afl->queued_paths);
|
((double)afl->queued_favored) * 100 / afl->queued_paths);
|
||||||
@ -533,7 +533,7 @@ void show_stats(afl_state_t *afl) {
|
|||||||
|
|
||||||
/* Aaaalmost there... hold on! */
|
/* Aaaalmost there... hold on! */
|
||||||
|
|
||||||
SAYF(bVR bH cCYA bSTOP
|
SAYF(bVR bH cCYA bSTOP
|
||||||
" fuzzing strategy yields " bSTG bH10 bHT bH10 bH5 bHB bH bSTOP cCYA
|
" fuzzing strategy yields " bSTG bH10 bHT bH10 bH5 bHB bH bSTOP cCYA
|
||||||
" path geometry " bSTG bH5 bH2 bVL "\n");
|
" path geometry " bSTG bH5 bH2 bVL "\n");
|
||||||
|
|
||||||
|
@ -48,10 +48,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static u8 *as_path; /* Path to the AFL 'as' wrapper */
|
static u8 * as_path; /* Path to the AFL 'as' wrapper */
|
||||||
static u8 **cc_params; /* Parameters passed to the real CC */
|
static u8 **cc_params; /* Parameters passed to the real CC */
|
||||||
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
|
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
|
||||||
static u8 be_quiet, /* Quiet mode */
|
static u8 be_quiet, /* Quiet mode */
|
||||||
clang_mode; /* Invoked as afl-clang*? */
|
clang_mode; /* Invoked as afl-clang*? */
|
||||||
|
|
||||||
/* Try to find our "fake" GNU assembler in AFL_PATH or at the location derived
|
/* Try to find our "fake" GNU assembler in AFL_PATH or at the location derived
|
||||||
|
@ -648,7 +648,7 @@ static void usage(u8 *argv0) {
|
|||||||
|
|
||||||
static void find_binary(afl_forkserver_t *fsrv, u8 *fname) {
|
static void find_binary(afl_forkserver_t *fsrv, u8 *fname) {
|
||||||
|
|
||||||
u8 *env_path = 0;
|
u8 * env_path = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (strchr(fname, '/') || !(env_path = getenv("PATH"))) {
|
if (strchr(fname, '/') || !(env_path = getenv("PATH"))) {
|
||||||
@ -928,10 +928,10 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
|
|
||||||
if (in_dir) {
|
if (in_dir) {
|
||||||
|
|
||||||
DIR *dir_in, *dir_out;
|
DIR * dir_in, *dir_out;
|
||||||
struct dirent *dir_ent;
|
struct dirent *dir_ent;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
u8 infile[4096], outfile[4096];
|
u8 infile[4096], outfile[4096];
|
||||||
#if !defined(DT_REG)
|
#if !defined(DT_REG)
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user