aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-03-10 22:04:05 +0100
committerDominik Maier <domenukk@gmail.com>2020-03-10 22:04:05 +0100
commitcc1d6b33b1524d52b21a6e9794ee6b0d6a2a9d50 (patch)
tree717c62b52076b37cb9d4e4efc9f33cf09dea723b /include
parent2832cb643d90ff6bad7a6ba4ff139988f10b171a (diff)
downloadafl++-cc1d6b33b1524d52b21a6e9794ee6b0d6a2a9d50.tar.gz
unified pointer placement
Diffstat (limited to 'include')
-rw-r--r--include/afl-as.h6
-rw-r--r--include/afl-fuzz.h258
-rw-r--r--include/alloc-inl.h130
-rw-r--r--include/common.h14
-rw-r--r--include/hash.h8
-rw-r--r--include/list.h4
6 files changed, 210 insertions, 210 deletions
diff --git a/include/afl-as.h b/include/afl-as.h
index 20830a67..7fc00ffe 100644
--- a/include/afl-as.h
+++ b/include/afl-as.h
@@ -108,7 +108,7 @@
*/
-static const u8* trampoline_fmt_32 =
+static const u8 *trampoline_fmt_32 =
"\n"
"/* --- AFL TRAMPOLINE (32-BIT) --- */\n"
@@ -131,7 +131,7 @@ static const u8* trampoline_fmt_32 =
"/* --- END --- */\n"
"\n";
-static const u8* trampoline_fmt_64 =
+static const u8 *trampoline_fmt_64 =
"\n"
"/* --- AFL TRAMPOLINE (64-BIT) --- */\n"
@@ -152,7 +152,7 @@ static const u8* trampoline_fmt_64 =
"/* --- END --- */\n"
"\n";
-static const u8* main_payload_32 =
+static const u8*main_payload_32 =
"\n"
"/* --- AFL MAIN PAYLOAD (32-BIT) --- */\n"
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h
index a28608ce..805d0084 100644
--- a/include/afl-fuzz.h
+++ b/include/afl-fuzz.h
@@ -115,7 +115,7 @@ extern s32
struct queue_entry {
- u8* fname; /* File name for the test case */
+ u8 *fname; /* File name for the test case */
u32 len; /* Input length */
u8 cal_failed, /* Calibration failed? */
@@ -137,7 +137,7 @@ struct queue_entry {
n_fuzz, /* Number of fuzz, does not overflow */
depth; /* Path depth */
- u8* trace_mini; /* Trace bytes, if kept */
+ u8 *trace_mini; /* Trace bytes, if kept */
u32 tc_ref; /* Trace bytes ref count */
struct queue_entry *next, /* Next element, if any */
@@ -147,7 +147,7 @@ struct queue_entry {
struct extra_data {
- u8* data; /* Dictionary token data */
+ u8 *data; /* Dictionary token data */
u32 len; /* Dictionary token length */
u32 hit_cnt; /* Use count in the corpus */
@@ -234,7 +234,7 @@ enum {
};
-extern u8* doc_path; /* gath to documentation dir */
+extern u8 *doc_path; /* gath to documentation dir */
/* Python stuff */
#ifdef USE_PYTHON
@@ -284,22 +284,22 @@ enum {
typedef struct MOpt_globals {
- u64* finds;
- u64* finds_v2;
- u64* cycles;
- u64* cycles_v2;
- u64* cycles_v3;
- u32 is_pilot_mode;
- u64* pTime;
- u64 period;
- char* havoc_stagename;
- char* splice_stageformat;
- char* havoc_stagenameshort;
- char* splice_stagenameshort;
+ u64 *finds;
+ u64 *finds_v2;
+ u64 *cycles;
+ u64 *cycles_v2;
+ u64 *cycles_v3;
+ u32 is_pilot_mode;
+ u64 *pTime;
+ u64 period;
+ char *havoc_stagename;
+ char *splice_stageformat;
+ char *havoc_stagenameshort;
+ char *splice_stagenameshort;
} MOpt_globals_t;
-extern char* power_names[POWER_SCHEDULES_NUM];
+extern char *power_names[POWER_SCHEDULES_NUM];
typedef struct afl_state {
@@ -309,7 +309,7 @@ typedef struct afl_state {
afl_forkserver_t fsrv;
sharedmem_t shm;
- char** argv; /* argv if needed */
+ char **argv; /* argv if needed */
/* MOpt:
Lots of globals, but mostly for the status UI and other things where it
@@ -378,7 +378,7 @@ typedef struct afl_state {
u8 havoc_max_mult;
u8 use_radamsa;
- size_t (*radamsa_mutate_ptr)(u8*, size_t, u8*, size_t, u32);
+ size_t (*radamsa_mutate_ptr)(u8 *, size_t, u8 *, size_t, u32);
u8 skip_deterministic, /* Skip deterministic stages? */
force_deterministic, /* Force deterministic stages? */
@@ -503,23 +503,23 @@ typedef struct afl_state {
*queue_top, /* Top of the list */
*q_prev100; /* Previous 100 marker */
- struct queue_entry* top_rated[MAP_SIZE]; /* Top entries for bitmap bytes */
+ struct queue_entry *top_rated[MAP_SIZE]; /* Top entries for bitmap bytes */
- struct extra_data* extras; /* Extra tokens to fuzz with */
+ struct extra_data *extras; /* Extra tokens to fuzz with */
u32 extras_cnt; /* Total number of tokens read */
- struct extra_data* a_extras; /* Automatically selected extras */
+ struct extra_data *a_extras; /* Automatically selected extras */
u32 a_extras_cnt; /* Total number of tokens available */
- u8* (*post_handler)(u8* buf, u32* len);
+ u8 *(*post_handler)(u8 *buf, u32 *len);
/* CmpLog */
- char* cmplog_binary;
+ char *cmplog_binary;
s32 cmplog_child_pid, cmplog_fsrv_pid;
/* Custom mutators */
- struct custom_mutator* mutator;
+ struct custom_mutator *mutator;
/* cmplog forkserver ids */
s32 cmplog_fsrv_ctl_fd, cmplog_fsrv_st_fd;
@@ -529,8 +529,8 @@ typedef struct afl_state {
#ifdef USE_PYTHON
/* Python Mutators */
- PyObject* py_module;
- PyObject* py_functions[PY_FUNC_COUNT];
+ PyObject *py_module;
+ PyObject *py_functions[PY_FUNC_COUNT];
#endif
#ifdef _AFL_DOCUMENT_MUTATIONS
@@ -547,8 +547,8 @@ extern list_t afl_states;
struct custom_mutator {
- const char* name;
- void* dh;
+ const char *name;
+ void *dh;
/* hooks for the custom mutator function */
@@ -559,7 +559,7 @@ struct custom_mutator {
*
* @param seed Seed used for the mutation.
*/
- void (*afl_custom_init)(afl_state_t* afl, unsigned int seed);
+ void (*afl_custom_init)(afl_state_t *afl, unsigned int seed);
/**
* Perform custom mutations on a given input
@@ -575,8 +575,8 @@ struct custom_mutator {
* not produce data larger than max_size.
* @return Size of the mutated output.
*/
- size_t (*afl_custom_fuzz)(afl_state_t* afl, u8** buf, size_t buf_size,
- u8* add_buf, size_t add_buf_size, size_t max_size);
+ size_t (*afl_custom_fuzz)(afl_state_t *afl, u8 **buf, size_t buf_size,
+ u8 *add_buf, size_t add_buf_size, size_t max_size);
/**
* A post-processing function to use right before AFL writes the test case to
@@ -592,8 +592,8 @@ struct custom_mutator {
* will release the memory after saving the test case.
* @return Size of the output buffer after processing
*/
- size_t (*afl_custom_pre_save)(afl_state_t* afl, u8* buf, size_t buf_size,
- u8** out_buf);
+ size_t (*afl_custom_pre_save)(afl_state_t *afl, u8 *buf, size_t buf_size,
+ u8 **out_buf);
/**
* This method is called at the start of each trimming operation and receives
@@ -615,7 +615,7 @@ struct custom_mutator {
* @param buf_size Size of the test case
* @return The amount of possible iteration steps to trim the input
*/
- u32 (*afl_custom_init_trim)(afl_state_t* afl, u8* buf, size_t buf_size);
+ u32 (*afl_custom_init_trim)(afl_state_t *afl, u8 *buf, size_t buf_size);
/**
* This method is called for each trimming operation. It doesn't have any
@@ -633,7 +633,7 @@ struct custom_mutator {
* the memory after saving the test case.
* @param[out] out_buf_size Pointer to the size of the trimmed test case
*/
- void (*afl_custom_trim)(afl_state_t* afl, u8** out_buf, size_t* out_buf_size);
+ void (*afl_custom_trim)(afl_state_t *afl, u8 **out_buf, size_t *out_buf_size);
/**
* This method is called after each trim operation to inform you if your
@@ -646,7 +646,7 @@ struct custom_mutator {
* @return The next trim iteration index (from 0 to the maximum amount of
* steps returned in init_trim)
*/
- u32 (*afl_custom_post_trim)(afl_state_t* afl, u8 success);
+ u32 (*afl_custom_post_trim)(afl_state_t *afl, u8 success);
/**
* Perform a single custom mutation on a given input.
@@ -661,7 +661,7 @@ struct custom_mutator {
* not produce data larger than max_size.
* @return Size of the mutated output.
*/
- size_t (*afl_custom_havoc_mutation)(afl_state_t* afl, u8** buf,
+ size_t (*afl_custom_havoc_mutation)(afl_state_t *afl, u8 **buf,
size_t buf_size, size_t max_size);
/**
@@ -672,7 +672,7 @@ struct custom_mutator {
*
* @return The probability (0-100).
*/
- u8 (*afl_custom_havoc_mutation_probability)(afl_state_t* afl);
+ u8 (*afl_custom_havoc_mutation_probability)(afl_state_t *afl);
/**
* Determine whether the fuzzer should fuzz the current queue entry or not.
@@ -683,7 +683,7 @@ struct custom_mutator {
* @return Return True(1) if the fuzzer will fuzz the queue entry, and
* False(0) otherwise.
*/
- u8 (*afl_custom_queue_get)(afl_state_t* afl, const u8* filename);
+ u8 (*afl_custom_queue_get)(afl_state_t *afl, const u8 *filename);
/**
* Allow for additional analysis (e.g. calling a different tool that does a
@@ -695,148 +695,148 @@ struct custom_mutator {
* @param filename_orig_queue File name of the original queue entry. This
* argument can be NULL while initializing the fuzzer
*/
- void (*afl_custom_queue_new_entry)(afl_state_t* afl,
- const u8* filename_new_queue,
- const u8* filename_orig_queue);
+ void (*afl_custom_queue_new_entry)(afl_state_t *afl,
+ const u8 *filename_new_queue,
+ const u8 *filename_orig_queue);
};
-void afl_state_init(afl_state_t*);
-void afl_state_deinit(afl_state_t*);
+void afl_state_init(afl_state_t *);
+void afl_state_deinit(afl_state_t *);
/**** Prototypes ****/
/* Custom mutators */
-void setup_custom_mutator(afl_state_t*);
-void destroy_custom_mutator(afl_state_t*);
-u8 trim_case_custom(afl_state_t*, struct queue_entry* q, u8* in_buf);
+void setup_custom_mutator(afl_state_t *);
+void destroy_custom_mutator(afl_state_t *);
+u8 trim_case_custom(afl_state_t *, struct queue_entry *q, u8 *in_buf);
/* Python */
#ifdef USE_PYTHON
-int init_py_module(afl_state_t*, u8*);
-void finalize_py_module(afl_state_t*);
+int init_py_module(afl_state_t *, u8 *);
+void finalize_py_module(afl_state_t *);
-void init_py(afl_state_t*, unsigned int);
-size_t fuzz_py(afl_state_t*, u8**, size_t, u8*, size_t, size_t);
-size_t pre_save_py(afl_state_t*, u8*, size_t, u8**);
-u32 init_trim_py(afl_state_t*, u8*, size_t);
-u32 post_trim_py(afl_state_t*, u8);
-void trim_py(afl_state_t*, u8**, size_t*);
-size_t havoc_mutation_py(afl_state_t*, u8**, size_t, size_t);
-u8 havoc_mutation_probability_py(afl_state_t*);
-u8 queue_get_py(afl_state_t*, const u8*);
-void queue_new_entry_py(afl_state_t*, const u8*, const u8*);
+void init_py(afl_state_t *, unsigned int);
+size_t fuzz_py(afl_state_t *, u8 **, size_t, u8 *, size_t, size_t);
+size_t pre_save_py(afl_state_t *, u8 *, size_t, u8 **);
+u32 init_trim_py(afl_state_t *, u8 *, size_t);
+u32 post_trim_py(afl_state_t *, u8);
+void trim_py(afl_state_t *, u8 **, size_t *);
+size_t havoc_mutation_py(afl_state_t *, u8 **, size_t, size_t);
+u8 havoc_mutation_probability_py(afl_state_t *);
+u8 queue_get_py(afl_state_t *, const u8 *);
+void queue_new_entry_py(afl_state_t *, const u8 *, const u8 *);
#endif
/* Queue */
-void mark_as_det_done(afl_state_t*, struct queue_entry*);
-void mark_as_variable(afl_state_t*, struct queue_entry*);
-void mark_as_redundant(afl_state_t*, struct queue_entry*, u8);
-void add_to_queue(afl_state_t*, u8*, u32, u8);
-void destroy_queue(afl_state_t*);
-void update_bitmap_score(afl_state_t*, struct queue_entry*);
-void cull_queue(afl_state_t*);
-u32 calculate_score(afl_state_t*, struct queue_entry*);
+void mark_as_det_done(afl_state_t *, struct queue_entry *);
+void mark_as_variable(afl_state_t *, struct queue_entry *);
+void mark_as_redundant(afl_state_t *, struct queue_entry *, u8);
+void add_to_queue(afl_state_t *, u8 *, u32, u8);
+void destroy_queue(afl_state_t *);
+void update_bitmap_score(afl_state_t *, struct queue_entry *);
+void cull_queue(afl_state_t *);
+u32 calculate_score(afl_state_t *, struct queue_entry *);
/* Bitmap */
-void read_bitmap(afl_state_t*, u8*);
-void write_bitmap(afl_state_t*);
-u32 count_bits(u8*);
-u32 count_bytes(u8*);
-u32 count_non_255_bytes(u8*);
+void read_bitmap(afl_state_t *, u8 *);
+void write_bitmap(afl_state_t *);
+u32 count_bits(u8 *);
+u32 count_bytes(u8 *);
+u32 count_non_255_bytes(u8 *);
#ifdef WORD_SIZE_64
-void simplify_trace(u64*);
-void classify_counts(u64*);
+void simplify_trace(u64 *);
+void classify_counts(u64 *);
#else
-void simplify_trace(u32*);
-void classify_counts(u32*);
+void simplify_trace(u32 *);
+void classify_counts(u32 *);
#endif
void init_count_class16(void);
-void minimize_bits(u8*, u8*);
+void minimize_bits(u8 *, u8 *);
#ifndef SIMPLE_FILES
-u8* describe_op(afl_state_t*, u8);
+u8 *describe_op(afl_state_t *, u8);
#endif
-u8 save_if_interesting(afl_state_t*, void*, u32, u8);
-u8 has_new_bits(afl_state_t*, u8*);
+u8 save_if_interesting(afl_state_t *, void *, u32, u8);
+u8 has_new_bits(afl_state_t *, u8 *);
/* Misc */
-u8* DI(u64);
-u8* DF(double);
-u8* DMS(u64);
-u8* DTD(u64, u64);
+u8 *DI(u64);
+u8 *DF(double);
+u8 *DMS(u64);
+u8 *DTD(u64, u64);
/* Extras */
-void load_extras_file(afl_state_t*, u8*, u32*, u32*, u32);
-void load_extras(afl_state_t*, u8*);
-void maybe_add_auto(afl_state_t*, u8*, u32);
-void save_auto(afl_state_t*);
-void load_auto(afl_state_t*);
-void destroy_extras(afl_state_t*);
+void load_extras_file(afl_state_t *, u8 *, u32 *, u32 *, u32);
+void load_extras(afl_state_t *, u8 *);
+void maybe_add_auto(afl_state_t *, u8 *, u32);
+void save_auto(afl_state_t *);
+void load_auto(afl_state_t *);
+void destroy_extras(afl_state_t *);
/* Stats */
-void write_stats_file(afl_state_t*, double, double, double);
-void maybe_update_plot_file(afl_state_t*, double, double);
-void show_stats(afl_state_t*);
-void show_init_stats(afl_state_t*);
+void write_stats_file(afl_state_t *, double, double, double);
+void maybe_update_plot_file(afl_state_t *, double, double);
+void show_stats(afl_state_t *);
+void show_init_stats(afl_state_t *);
/* Run */
-u8 run_target(afl_state_t*, u32);
-void write_to_testcase(afl_state_t*, void*, u32);
-u8 calibrate_case(afl_state_t*, struct queue_entry*, u8*, u32, u8);
-void sync_fuzzers(afl_state_t*);
-u8 trim_case(afl_state_t*, struct queue_entry*, u8*);
-u8 common_fuzz_stuff(afl_state_t*, u8*, u32);
+u8 run_target(afl_state_t *, u32);
+void write_to_testcase(afl_state_t *, void *, u32);
+u8 calibrate_case(afl_state_t *, struct queue_entry *, u8 *, u32, u8);
+void sync_fuzzers(afl_state_t *);
+u8 trim_case(afl_state_t *, struct queue_entry *, u8 *);
+u8 common_fuzz_stuff(afl_state_t *, u8 *, u32);
/* Fuzz one */
-u8 fuzz_one_original(afl_state_t*);
-u8 pilot_fuzzing(afl_state_t*);
-u8 core_fuzzing(afl_state_t*);
-void pso_updating(afl_state_t*);
-u8 fuzz_one(afl_state_t*);
+u8 fuzz_one_original(afl_state_t *);
+u8 pilot_fuzzing(afl_state_t *);
+u8 core_fuzzing(afl_state_t *);
+void pso_updating(afl_state_t *);
+u8 fuzz_one(afl_state_t *);
/* Init */
#ifdef HAVE_AFFINITY
-void bind_to_free_cpu(afl_state_t*);
+void bind_to_free_cpu(afl_state_t *);
#endif
-void setup_post(afl_state_t*);
-void read_testcases(afl_state_t*);
-void perform_dry_run(afl_state_t*);
-void pivot_inputs(afl_state_t*);
-u32 find_start_position(afl_state_t*);
-void find_timeout(afl_state_t*);
+void setup_post(afl_state_t *);
+void read_testcases(afl_state_t *);
+void perform_dry_run(afl_state_t *);
+void pivot_inputs(afl_state_t *);
+u32 find_start_position(afl_state_t *);
+void find_timeout(afl_state_t *);
double get_runnable_processes(void);
-void nuke_resume_dir(afl_state_t*);
-void setup_dirs_fds(afl_state_t*);
-void setup_cmdline_file(afl_state_t*, char**);
-void setup_stdio_file(afl_state_t*);
+void nuke_resume_dir(afl_state_t *);
+void setup_dirs_fds(afl_state_t *);
+void setup_cmdline_file(afl_state_t *, char **);
+void setup_stdio_file(afl_state_t *);
void check_crash_handling(void);
-void check_cpu_governor(afl_state_t*);
-void get_core_count(afl_state_t*);
-void fix_up_sync(afl_state_t*);
+void check_cpu_governor(afl_state_t *);
+void get_core_count(afl_state_t *);
+void fix_up_sync(afl_state_t *);
void check_asan_opts(void);
-void check_binary(afl_state_t*, u8*);
-void fix_up_banner(afl_state_t*, u8*);
-void check_if_tty(afl_state_t*);
+void check_binary(afl_state_t *, u8 *);
+void fix_up_banner(afl_state_t *, u8 *);
+void check_if_tty(afl_state_t *);
void setup_signal_handlers(void);
-void save_cmdline(afl_state_t*, u32, char**);
+void save_cmdline(afl_state_t *, u32, char **);
/* CmpLog */
-void init_cmplog_forkserver(afl_state_t* afl);
-u8 common_fuzz_cmplog_stuff(afl_state_t* afl, u8* out_buf, u32 len);
+void init_cmplog_forkserver(afl_state_t *afl);
+u8 common_fuzz_cmplog_stuff(afl_state_t *afl, u8 *out_buf, u32 len);
/* RedQueen */
-u8 input_to_state_stage(afl_state_t* afl, u8* orig_buf, u8* buf, u32 len,
+u8 input_to_state_stage(afl_state_t *afl, u8 *orig_buf, u8 *buf, u32 len,
u32 exec_cksum);
/**** Inline routines ****/
@@ -844,7 +844,7 @@ u8 input_to_state_stage(afl_state_t* afl, u8* orig_buf, u8* buf, u32 len,
/* Generate a random number (from 0 to limit - 1). This may
have slight bias. */
-static inline u32 UR(afl_state_t* afl, u32 limit) {
+static inline u32 UR(afl_state_t *afl, u32 limit) {
#ifdef HAVE_ARC4RANDOM
if (afl->fixed_seed) { return random() % limit; }
@@ -867,7 +867,7 @@ static inline u32 UR(afl_state_t* afl, u32 limit) {
}
-static inline u32 get_rand_seed(afl_state_t* afl) {
+static inline u32 get_rand_seed(afl_state_t *afl) {
if (afl->fixed_seed) return (u32)afl->init_seed;
return afl->rand_seed[0];
diff --git a/include/alloc-inl.h b/include/alloc-inl.h
index 4f9db489..c8783d96 100644
--- a/include/alloc-inl.h
+++ b/include/alloc-inl.h
@@ -45,11 +45,11 @@
#define alloc_printf(_str...) \
({ \
\
- u8* _tmp; \
+ u8 *_tmp; \
s32 _len = snprintf(NULL, 0, _str); \
if (_len < 0) FATAL("Whoa, snprintf() fails?!"); \
_tmp = ck_alloc(_len + 1); \
- snprintf((char*)_tmp, _len + 1, _str); \
+ snprintf((char *)_tmp, _len + 1, _str); \
_tmp; \
\
})
@@ -80,9 +80,9 @@
/* Allocate a buffer, explicitly not zeroing it. Returns NULL for zero-sized
requests. */
-static inline void* DFL_ck_alloc_nozero(u32 size) {
+static inline void *DFL_ck_alloc_nozero(u32 size) {
- u8* ret;
+ u8 *ret;
if (!size) return NULL;
@@ -90,15 +90,15 @@ static inline void* DFL_ck_alloc_nozero(u32 size) {
ret = malloc(size);
ALLOC_CHECK_RESULT(ret, size);
- return (void*)ret;
+ return (void *)ret;
}
/* Allocate a buffer, returning zeroed memory. */
-static inline void* DFL_ck_alloc(u32 size) {
+static inline void *DFL_ck_alloc(u32 size) {
- void* mem;
+ void *mem;
if (!size) return NULL;
mem = DFL_ck_alloc_nozero(size);
@@ -110,7 +110,7 @@ static inline void* DFL_ck_alloc(u32 size) {
/* Free memory, checking for double free and corrupted heap. When DEBUG_BUILD
is set, the old memory will be also clobbered with 0xFF. */
-static inline void DFL_ck_free(void* mem) {
+static inline void DFL_ck_free(void *mem) {
if (!mem) return;
@@ -122,9 +122,9 @@ static inline void DFL_ck_free(void* mem) {
With DEBUG_BUILD, the buffer is always reallocated to a new addresses and the
old memory is clobbered with 0xFF. */
-static inline void* DFL_ck_realloc(void* orig, u32 size) {
+static inline void *DFL_ck_realloc(void *orig, u32 size) {
- u8* ret;
+ u8 *ret;
if (!size) {
@@ -142,14 +142,14 @@ static inline void* DFL_ck_realloc(void* orig, u32 size) {
ALLOC_CHECK_RESULT(ret, size);
- return (void*)ret;
+ return (void *)ret;
}
/* Re-allocate a buffer with ALLOC_BLK_INC increments (used to speed up
repeated small reallocs without complicating the user code). */
-static inline void* DFL_ck_realloc_block(void* orig, u32 size) {
+static inline void *DFL_ck_realloc_block(void *orig, u32 size) {
return DFL_ck_realloc(orig, size);
@@ -157,14 +157,14 @@ static inline void* DFL_ck_realloc_block(void* orig, u32 size) {
/* Create a buffer with a copy of a string. Returns NULL for NULL inputs. */
-static inline u8* DFL_ck_strdup(u8* str) {
+static inline u8 *DFL_ck_strdup(u8 *str) {
- u8* ret;
+ u8 *ret;
u32 size;
if (!str) return NULL;
- size = strlen((char*)str) + 1;
+ size = strlen((char *)str) + 1;
ALLOC_CHECK_SIZE(size);
ret = malloc(size);
@@ -177,9 +177,9 @@ static inline u8* DFL_ck_strdup(u8* str) {
/* Create a buffer with a copy of a memory block. Returns NULL for zero-sized
or NULL inputs. */
-static inline void* DFL_ck_memdup(void* mem, u32 size) {
+static inline void *DFL_ck_memdup(void *mem, u32 size) {
- u8* ret;
+ u8 *ret;
if (!mem || !size) return NULL;
@@ -194,9 +194,9 @@ static inline void* DFL_ck_memdup(void* mem, u32 size) {
/* Create a buffer with a block of text, appending a NUL terminator at the end.
Returns NULL for zero-sized or NULL inputs. */
-static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) {
+static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) {
- u8* ret;
+ u8 *ret;
if (!mem || !size) return NULL;
@@ -233,11 +233,11 @@ static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) {
#define alloc_printf(_str...) \
({ \
\
- u8* _tmp; \
+ u8 *_tmp; \
s32 _len = snprintf(NULL, 0, _str); \
if (_len < 0) FATAL("Whoa, snprintf() fails?!"); \
_tmp = ck_alloc(_len + 1); \
- snprintf((char*)_tmp, _len + 1, _str); \
+ snprintf((char *)_tmp, _len + 1, _str); \
_tmp; \
\
})
@@ -269,9 +269,9 @@ static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) {
/* Positions of guard tokens in relation to the user-visible pointer. */
-#define ALLOC_C1(_ptr) (((u32*)(_ptr))[-2])
-#define ALLOC_S(_ptr) (((u32*)(_ptr))[-1])
-#define ALLOC_C2(_ptr) (((u8*)(_ptr))[ALLOC_S(_ptr)])
+#define ALLOC_C1(_ptr) (((u32 *)(_ptr))[-2])
+#define ALLOC_S(_ptr) (((u32 *)(_ptr))[-1])
+#define ALLOC_C2(_ptr) (((u8 *)(_ptr))[ALLOC_S(_ptr)])
#define ALLOC_OFF_HEAD 8
#define ALLOC_OFF_TOTAL (ALLOC_OFF_HEAD + 1)
@@ -314,9 +314,9 @@ static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) {
/* Allocate a buffer, explicitly not zeroing it. Returns NULL for zero-sized
requests. */
-static inline void* DFL_ck_alloc_nozero(u32 size) {
+static inline void *DFL_ck_alloc_nozero(u32 size) {
- void* ret;
+ void *ret;
if (!size) return NULL;
@@ -336,9 +336,9 @@ static inline void* DFL_ck_alloc_nozero(u32 size) {
/* Allocate a buffer, returning zeroed memory. */
-static inline void* DFL_ck_alloc(u32 size) {
+static inline void *DFL_ck_alloc(u32 size) {
- void* mem;
+ void *mem;
if (!size) return NULL;
mem = DFL_ck_alloc_nozero(size);
@@ -350,7 +350,7 @@ static inline void* DFL_ck_alloc(u32 size) {
/* Free memory, checking for double free and corrupted heap. When DEBUG_BUILD
is set, the old memory will be also clobbered with 0xFF. */
-static inline void DFL_ck_free(void* mem) {
+static inline void DFL_ck_free(void *mem) {
if (!mem) return;
@@ -373,9 +373,9 @@ static inline void DFL_ck_free(void* mem) {
With DEBUG_BUILD, the buffer is always reallocated to a new addresses and the
old memory is clobbered with 0xFF. */
-static inline void* DFL_ck_realloc(void* orig, u32 size) {
+static inline void *DFL_ck_realloc(void *orig, u32 size) {
- void* ret;
+ void *ret;
u32 old_size = 0;
if (!size) {
@@ -443,7 +443,7 @@ static inline void* DFL_ck_realloc(void* orig, u32 size) {
/* Re-allocate a buffer with ALLOC_BLK_INC increments (used to speed up
repeated small reallocs without complicating the user code). */
-static inline void* DFL_ck_realloc_block(void* orig, u32 size) {
+static inline void *DFL_ck_realloc_block(void *orig, u32 size) {
#ifndef DEBUG_BUILD
@@ -465,14 +465,14 @@ static inline void* DFL_ck_realloc_block(void* orig, u32 size) {
/* Create a buffer with a copy of a string. Returns NULL for NULL inputs. */
-static inline u8* DFL_ck_strdup(u8* str) {
+static inline u8 *DFL_ck_strdup(u8 *str) {
- void* ret;
+ void *ret;
u32 size;
if (!str) return NULL;
- size = strlen((char*)str) + 1;
+ size = strlen((char *)str) + 1;
ALLOC_CHECK_SIZE(size);
ret = malloc(size + ALLOC_OFF_TOTAL);
@@ -491,9 +491,9 @@ static inline u8* DFL_ck_strdup(u8* str) {
/* Create a buffer with a copy of a memory block. Returns NULL for zero-sized
or NULL inputs. */
-static inline void* DFL_ck_memdup(void* mem, u32 size) {
+static inline void *DFL_ck_memdup(void *mem, u32 size) {
- void* ret;
+ void *ret;
if (!mem || !size) return NULL;
@@ -514,9 +514,9 @@ static inline void* DFL_ck_memdup(void* mem, u32 size) {
/* Create a buffer with a block of text, appending a NUL terminator at the end.
Returns NULL for zero-sized or NULL inputs. */
-static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) {
+static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) {
- u8* ret;
+ u8 *ret;
if (!mem || !size) return NULL;
@@ -564,7 +564,7 @@ static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) {
struct TRK_obj {
- void* ptr;
+ void *ptr;
char *file, *func;
u32 line;
@@ -572,14 +572,14 @@ struct TRK_obj {
#ifdef AFL_MAIN
-struct TRK_obj* TRK[ALLOC_BUCKETS];
+struct TRK_obj *TRK[ALLOC_BUCKETS];
u32 TRK_cnt[ALLOC_BUCKETS];
#define alloc_report() TRK_report()
#else
-extern struct TRK_obj* TRK[ALLOC_BUCKETS];
+extern struct TRK_obj *TRK[ALLOC_BUCKETS];
extern u32 TRK_cnt[ALLOC_BUCKETS];
#define alloc_report()
@@ -592,7 +592,7 @@ extern u32 TRK_cnt[ALLOC_BUCKETS];
/* Add a new entry to the list of allocated objects. */
-static inline void TRK_alloc_buf(void* ptr, const char* file, const char* func,
+static inline void TRK_alloc_buf(void *ptr, const char *file, const char *func,
u32 line) {
u32 i, bucket;
@@ -608,8 +608,8 @@ static inline void TRK_alloc_buf(void* ptr, const char* file, const char* func,
if (!TRK[bucket][i].ptr) {
TRK[bucket][i].ptr = ptr;
- TRK[bucket][i].file = (char*)file;
- TRK[bucket][i].func = (char*)func;
+ TRK[bucket][i].file = (char *)file;
+ TRK[bucket][i].func = (char *)func;
TRK[bucket][i].line = line;
return;
@@ -621,8 +621,8 @@ static inline void TRK_alloc_buf(void* ptr, const char* file, const char* func,
TRK[bucket], (TRK_cnt[bucket] + 1) * sizeof(struct TRK_obj));
TRK[bucket][i].ptr = ptr;
- TRK[bucket][i].file = (char*)file;
- TRK[bucket][i].func = (char*)func;
+ TRK[bucket][i].file = (char *)file;
+ TRK[bucket][i].func = (char *)func;
TRK[bucket][i].line = line;
TRK_cnt[bucket]++;
@@ -631,7 +631,7 @@ static inline void TRK_alloc_buf(void* ptr, const char* file, const char* func,
/* Remove entry from the list of allocated objects. */
-static inline void TRK_free_buf(void* ptr, const char* file, const char* func,
+static inline void TRK_free_buf(void *ptr, const char *file, const char *func,
u32 line) {
u32 i, bucket;
@@ -674,63 +674,63 @@ static inline void TRK_report(void) {
/* Simple wrappers for non-debugging functions: */
-static inline void* TRK_ck_alloc(u32 size, const char* file, const char* func,
+static inline void *TRK_ck_alloc(u32 size, const char *file, const char *func,
u32 line) {
- void* ret = DFL_ck_alloc(size);
+ void *ret = DFL_ck_alloc(size);
TRK_alloc_buf(ret, file, func, line);
return ret;
}
-static inline void* TRK_ck_realloc(void* orig, u32 size, const char* file,
- const char* func, u32 line) {
+static inline void *TRK_ck_realloc(void *orig, u32 size, const char *file,
+ const char *func, u32 line) {
- void* ret = DFL_ck_realloc(orig, size);
+ void *ret = DFL_ck_realloc(orig, size);
TRK_free_buf(orig, file, func, line);
TRK_alloc_buf(ret, file, func, line);
return ret;
}
-static inline void* TRK_ck_realloc_block(void* orig, u32 size, const char* file,
- const char* func, u32 line) {
+static inline void *TRK_ck_realloc_block(void *orig, u32 size, const char *file,
+ const char *func, u32 line) {
- void* ret = DFL_ck_realloc_block(orig, size);
+ void *ret = DFL_ck_realloc_block(orig, size);
TRK_free_buf(orig, file, func, line);
TRK_alloc_buf(ret, file, func, line);
return ret;
}
-static inline void* TRK_ck_strdup(u8* str, const char* file, const char* func,
+static inline void *TRK_ck_strdup(u8 *str, const char *file, const char *func,
u32 line) {
- void* ret = DFL_ck_strdup(str);
+ void *ret = DFL_ck_strdup(str);
TRK_alloc_buf(ret, file, func, line);
return ret;
}
-static inline void* TRK_ck_memdup(void* mem, u32 size, const char* file,
- const char* func, u32 line) {
+static inline void *TRK_ck_memdup(void *mem, u32 size, const char *file,
+ const char *func, u32 line) {
- void* ret = DFL_ck_memdup(mem, size);
+ void *ret = DFL_ck_memdup(mem, size);
TRK_alloc_buf(ret, file, func, line);
return ret;
}
-static inline void* TRK_ck_memdup_str(void* mem, u32 size, const char* file,
- const char* func, u32 line) {
+static inline void *TRK_ck_memdup_str(void *mem, u32 size, const char *file,
+ const char *func, u32 line) {
- void* ret = DFL_ck_memdup_str(mem, size);
+ void *ret = DFL_ck_memdup_str(mem, size);
TRK_alloc_buf(ret, file, func, line);
return ret;
}
-static inline void TRK_ck_free(void* ptr, const char* file, const char* func,
+static inline void TRK_ck_free(void *ptr, const char *file, const char *func,
u32 line) {
TRK_free_buf(ptr, file, func, line);
diff --git a/include/common.h b/include/common.h
index 504783ba..28c11049 100644
--- a/include/common.h
+++ b/include/common.h
@@ -31,15 +31,15 @@
#include "types.h"
#include "stdbool.h"
-void detect_file_args(char** argv, u8* prog_in, u8* use_stdin);
-void check_environment_vars(char** env);
+void detect_file_args(char **argv, u8 *prog_in, u8 *use_stdin);
+void check_environment_vars(char **env);
-char** argv_cpy_dup(int argc, char** argv);
-void argv_cpy_free(char** argv);
+char **argv_cpy_dup(int argc, char **argv);
+void argv_cpy_free(char **argv);
-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_afl_env(char* env);
+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_afl_env(char *env);
/* Get unix time in milliseconds */
diff --git a/include/hash.h b/include/hash.h
index 5d00f3e5..3751ac33 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -34,9 +34,9 @@
#define ROL64(_x, _r) ((((u64)(_x)) << (_r)) | (((u64)(_x)) >> (64 - (_r))))
-static inline u32 hash32(const void* key, u32 len, u32 seed) {
+static inline u32 hash32(const void *key, u32 len, u32 seed) {
- const u64* data = (u64*)key;
+ const u64 *data = (u64 *)key;
u64 h1 = seed ^ len;
len >>= 3;
@@ -69,9 +69,9 @@ static inline u32 hash32(const void* key, u32 len, u32 seed) {
#define ROL32(_x, _r) ((((u32)(_x)) << (_r)) | (((u32)(_x)) >> (32 - (_r))))
-static inline u32 hash32(const void* key, u32 len, u32 seed) {
+static inline u32 hash32(const void *key, u32 len, u32 seed) {
- const u32* data = (u32*)key;
+ const u32 *data = (u32 *)key;
u32 h1 = seed ^ len;
len >>= 2;
diff --git a/include/list.h b/include/list.h
index 1190931f..f9760ccf 100644
--- a/include/list.h
+++ b/include/list.h
@@ -43,7 +43,7 @@ typedef struct list_element {
struct list_element *prev;
struct list_element *next;
- void * data;
+ void *data;
} element_t;
@@ -100,7 +100,7 @@ static void list_append(list_t *list, void *el) {
#define LIST_FOREACH(list, type, block) \
do { \
\
- list_t * li = (list); \
+ list_t *li = (list); \
element_t *head = get_head((li)); \
element_t *el_box = (head)->next; \
if (!el_box) FATAL("foreach over uninitialized list"); \