diff options
author | van Hauser <vh@thc.org> | 2020-05-12 11:04:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-12 11:04:18 +0200 |
commit | 1317433a51a7f7336c82c80a592835ddda9ef60f (patch) | |
tree | e623506f1d0a8771c3fc266eed0a75b626a88724 /include | |
parent | bdd2a412c476cbd5aea0fff67ef096305815953b (diff) | |
parent | a578d719e1f556db07ca3c7e2fe38b7668c204d8 (diff) | |
download | afl++-1317433a51a7f7336c82c80a592835ddda9ef60f.tar.gz |
Merge pull request #359 from AFLplusplus/dev
push to master
Diffstat (limited to 'include')
-rw-r--r-- | include/afl-fuzz.h | 17 | ||||
-rw-r--r-- | include/alloc-inl.h | 14 | ||||
-rw-r--r-- | include/types.h | 6 |
3 files changed, 24 insertions, 13 deletions
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index 2203cfdf..9f306b7e 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -33,7 +33,9 @@ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif +#ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 +#endif #ifdef __ANDROID__ #include "android-ashmem.h" @@ -607,6 +609,9 @@ typedef struct afl_state { u8 * ex_buf; size_t ex_size; + u32 custom_mutators_count; + + list_t custom_mutator_list; /* this is a fixed buffer of size map_size that can be used by any function if * they do not call another function */ @@ -620,6 +625,7 @@ struct custom_mutator { void * dh; u8 * pre_save_buf; size_t pre_save_size; + u8 stacked_custom_prob, stacked_custom; void *data; /* custom mutator data ptr */ @@ -808,15 +814,16 @@ void read_afl_environment(afl_state_t *, char **); /**** 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_mutators(afl_state_t *); +void destroy_custom_mutators(afl_state_t *); +u8 trim_case_custom(afl_state_t *, struct queue_entry *q, u8 *in_buf, + struct custom_mutator *mutator); /* Python */ #ifdef USE_PYTHON -void load_custom_mutator_py(afl_state_t *, char *); -void finalize_py_module(void *); +struct custom_mutator *load_custom_mutator_py(afl_state_t *, char *); +void finalize_py_module(void *); size_t pre_save_py(void *, u8 *, size_t, u8 **); s32 init_trim_py(void *, u8 *, size_t); diff --git a/include/alloc-inl.h b/include/alloc-inl.h index e5547fe0..485446de 100644 --- a/include/alloc-inl.h +++ b/include/alloc-inl.h @@ -214,8 +214,8 @@ static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) { } -/* In non-debug mode, we just do straightforward aliasing of the above functions - to user-visible names such as ck_alloc(). */ +/* In non-debug mode, we just do straightforward aliasing of the above + functions to user-visible names such as ck_alloc(). */ #define ck_alloc DFL_ck_alloc #define ck_alloc_nozero DFL_ck_alloc_nozero @@ -247,7 +247,6 @@ static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) { /* Macro to enforce allocation limits as a last-resort defense against integer overflows. */ - #define ALLOC_CHECK_SIZE(_s) \ do { \ \ @@ -358,7 +357,6 @@ static inline void DFL_ck_free(void *mem) { if (!mem) return; CHECK_PTR(mem); - #ifdef DEBUG_BUILD /* Catch pointer issues sooner. */ @@ -542,8 +540,8 @@ static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) { #ifndef DEBUG_BUILD -/* In non-debug mode, we just do straightforward aliasing of the above functions - to user-visible names such as ck_alloc(). */ +/* In non-debug mode, we just do straightforward aliasing of the above + functions to user-visible names such as ck_alloc(). */ #define ck_alloc DFL_ck_alloc #define ck_alloc_nozero DFL_ck_alloc_nozero @@ -558,8 +556,8 @@ static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) { #else -/* In debugging mode, we also track allocations to detect memory leaks, and the - flow goes through one more layer of indirection. */ +/* In debugging mode, we also track allocations to detect memory leaks, and + the flow goes through one more layer of indirection. */ /* Alloc tracking data structures: */ diff --git a/include/types.h b/include/types.h index e7ff131d..72d2ba51 100644 --- a/include/types.h +++ b/include/types.h @@ -89,6 +89,7 @@ typedef int64_t s64; _a < _b ? _a : _b; \ \ }) + #define MAX(a, b) \ ({ \ \ @@ -97,6 +98,7 @@ typedef int64_t s64; _a > _b ? _a : _b; \ \ }) + #endif /* !MIN */ #define SWAP16(_x) \ @@ -154,8 +156,12 @@ typedef int64_t s64; #define MEM_BARRIER() __asm__ volatile("" ::: "memory") #if __GNUC__ < 6 +#ifndef likely #define likely(_x) (_x) +#endif +#ifndef unlikely #define unlikely(_x) (_x) +#endif #else #ifndef likely #define likely(_x) __builtin_expect(!!(_x), 1) |