diff options
-rwxr-xr-x | .custom-format.py | 19 | ||||
-rw-r--r-- | include/afl-as.h | 12 | ||||
-rw-r--r-- | include/afl-fuzz.h | 16 | ||||
-rw-r--r-- | include/alloc-inl.h | 52 | ||||
-rw-r--r-- | include/android-ashmem.h | 8 | ||||
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | include/debug.h | 200 | ||||
-rw-r--r-- | include/forkserver.h | 8 | ||||
-rw-r--r-- | include/hash.h | 4 | ||||
-rw-r--r-- | include/types.h | 16 | ||||
-rw-r--r-- | libdislocator/libdislocator.so.c | 4 | ||||
-rw-r--r-- | libtokencap/libtokencap.so.c | 2 | ||||
-rw-r--r-- | llvm_mode/MarkNodes.h | 8 | ||||
-rw-r--r-- | llvm_mode/afl-llvm-rt.o.c | 6 | ||||
-rw-r--r-- | qemu_mode/libcompcov/libcompcov.so.c | 2 | ||||
-rw-r--r-- | qemu_mode/libcompcov/pmparser.h | 22 | ||||
-rw-r--r-- | qemu_mode/patches/afl-qemu-common.h | 4 | ||||
-rw-r--r-- | src/afl-analyze.c | 2 | ||||
-rw-r--r-- | src/afl-as.c | 6 | ||||
-rw-r--r-- | src/afl-common.c | 2 | ||||
-rw-r--r-- | src/afl-fuzz-init.c | 16 | ||||
-rw-r--r-- | src/afl-fuzz-one.c | 6 | ||||
-rw-r--r-- | src/afl-fuzz.c | 18 | ||||
-rw-r--r-- | src/afl-gotcpu.c | 6 | ||||
-rw-r--r-- | src/afl-sharedmem.c | 6 | ||||
-rw-r--r-- | src/afl-showmap.c | 2 | ||||
-rw-r--r-- | src/afl-tmin.c | 2 | ||||
-rw-r--r-- | unicorn_mode/patches/afl-unicorn-common.h | 4 |
28 files changed, 223 insertions, 234 deletions
diff --git a/.custom-format.py b/.custom-format.py index 32b8f7c9..81adbd85 100755 --- a/.custom-format.py +++ b/.custom-format.py @@ -45,31 +45,14 @@ def custom_format(filename): src, _ = p.communicate() src = str(src, "utf-8") - macro_indent = 0 in_define = False last_line = None out = "" for line in src.split("\n"): if line.startswith("#"): - i = macro_indent - if line.startswith("#end") and macro_indent > 0: - macro_indent -= 1 - i -= 1 - elif line.startswith("#el") and macro_indent > 0: - i -= 1 - elif line.startswith("#if") and not (line.startswith("#ifndef") and (line.endswith("_H") or line.endswith("H_"))): - macro_indent += 1 - elif line.startswith("#define"): + if line.startswith("#define"): in_define = True - r = "#" + (i * " ") + line[1:] - if i != 0 and line.endswith("\\"): - r = r[:-1] - while r[-1].isspace() and len(r) != (len(line)-1): - r = r[:-1] - r += "\\" - if len(r) <= COLUMN_LIMIT: - line = r elif "/*" in line and not line.strip().startswith("/*") and line.endswith("*/") and len(line) < (COLUMN_LIMIT-2): cmt_start = line.rfind("/*") diff --git a/include/afl-as.h b/include/afl-as.h index 4f8fb640..55d8694d 100644 --- a/include/afl-as.h +++ b/include/afl-as.h @@ -398,9 +398,9 @@ static const u8* main_payload_32 = recognize .string. */ #ifdef __APPLE__ -# define CALL_L64(str) "call _" str "\n" +#define CALL_L64(str) "call _" str "\n" #else -# define CALL_L64(str) "call " str "@PLT\n" +#define CALL_L64(str) "call " str "@PLT\n" #endif /* ^__APPLE__ */ static const u8* main_payload_64 = @@ -737,9 +737,9 @@ static const u8* main_payload_64 = #ifdef __APPLE__ " .comm __afl_area_ptr, 8\n" -# ifndef COVERAGE_ONLY +#ifndef COVERAGE_ONLY " .comm __afl_prev_loc, 8\n" -# endif /* !COVERAGE_ONLY */ +#endif /* !COVERAGE_ONLY */ " .comm __afl_fork_pid, 4\n" " .comm __afl_temp, 4\n" " .comm __afl_setup_failure, 1\n" @@ -747,9 +747,9 @@ static const u8* main_payload_64 = #else " .lcomm __afl_area_ptr, 8\n" -# ifndef COVERAGE_ONLY +#ifndef COVERAGE_ONLY " .lcomm __afl_prev_loc, 8\n" -# endif /* !COVERAGE_ONLY */ +#endif /* !COVERAGE_ONLY */ " .lcomm __afl_fork_pid, 4\n" " .lcomm __afl_temp, 4\n" " .lcomm __afl_setup_failure, 1\n" diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index b5c5afaf..3206ee72 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -27,12 +27,12 @@ #define MESSAGES_TO_STDOUT #ifndef _GNU_SOURCE -# define _GNU_SOURCE +#define _GNU_SOURCE #endif #define _FILE_OFFSET_BITS 64 #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" @@ -69,21 +69,21 @@ #include <sys/file.h> #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) -# include <sys/sysctl.h> -# define HAVE_ARC4RANDOM 1 +#include <sys/sysctl.h> +#define HAVE_ARC4RANDOM 1 #endif /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */ /* For systems that have sched_setaffinity; right now just Linux, but one can hope... */ #ifdef __linux__ -# define HAVE_AFFINITY 1 +#define HAVE_AFFINITY 1 #endif /* __linux__ */ #ifndef SIMPLE_FILES -# define CASE_PREFIX "id:" +#define CASE_PREFIX "id:" #else -# define CASE_PREFIX "id_" +#define CASE_PREFIX "id_" #endif /* ^!SIMPLE_FILES */ struct queue_entry { @@ -432,7 +432,7 @@ extern s32 /* Python stuff */ #ifdef USE_PYTHON -# include <Python.h> +#include <Python.h> extern PyObject* py_module; diff --git a/include/alloc-inl.h b/include/alloc-inl.h index 302d15b6..6e46ae19 100644 --- a/include/alloc-inl.h +++ b/include/alloc-inl.h @@ -105,18 +105,22 @@ #define CHECK_PTR(_p) do { \ \ \ + \ if (_p) { \ \ \ + \ if (ALLOC_C1(_p) ^ ALLOC_MAGIC_C1) {\ \ \ + \ if (ALLOC_C1(_p) == ALLOC_MAGIC_F) \ ABORT("Use after free."); \ else ABORT("Corrupted head alloc canary."); \ \ } \ \ + \ if (ALLOC_C2(_p) ^ ALLOC_MAGIC_C2) \ ABORT("Corrupted tail alloc canary."); \ \ @@ -124,7 +128,9 @@ \ \ \ + \ } while (0) + */ #define CHECK_PTR_EXPR(_p) \ @@ -371,16 +377,16 @@ 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(). */ -# define ck_alloc DFL_ck_alloc -# define ck_alloc_nozero DFL_ck_alloc_nozero -# define ck_realloc DFL_ck_realloc -# define ck_realloc_block DFL_ck_realloc_block -# define ck_strdup DFL_ck_strdup -# define ck_memdup DFL_ck_memdup -# define ck_memdup_str DFL_ck_memdup_str -# define ck_free DFL_ck_free +#define ck_alloc DFL_ck_alloc +#define ck_alloc_nozero DFL_ck_alloc_nozero +#define ck_realloc DFL_ck_realloc +#define ck_realloc_block DFL_ck_realloc_block +#define ck_strdup DFL_ck_strdup +#define ck_memdup DFL_ck_memdup +#define ck_memdup_str DFL_ck_memdup_str +#define ck_free DFL_ck_free -# define alloc_report() +#define alloc_report() #else @@ -389,7 +395,7 @@ static inline u8* DFL_ck_memdup_str(u8* mem, u32 size) { /* Alloc tracking data structures: */ -# define ALLOC_BUCKETS 4096 +#define ALLOC_BUCKETS 4096 struct TRK_obj { @@ -399,25 +405,25 @@ struct TRK_obj { }; -# ifdef AFL_MAIN +#ifdef AFL_MAIN struct TRK_obj* TRK[ALLOC_BUCKETS]; u32 TRK_cnt[ALLOC_BUCKETS]; -# define alloc_report() TRK_report() +#define alloc_report() TRK_report() -# else +#else extern struct TRK_obj* TRK[ALLOC_BUCKETS]; extern u32 TRK_cnt[ALLOC_BUCKETS]; -# define alloc_report() +#define alloc_report() -# endif /* ^AFL_MAIN */ +#endif /* ^AFL_MAIN */ /* Bucket-assigning function for a given pointer: */ -# define TRKH(_ptr) (((((u32)(_ptr)) >> 16) ^ ((u32)(_ptr))) % ALLOC_BUCKETS) +#define TRKH(_ptr) (((((u32)(_ptr)) >> 16) ^ ((u32)(_ptr))) % ALLOC_BUCKETS) /* Add a new entry to the list of allocated objects. */ @@ -569,25 +575,25 @@ static inline void TRK_ck_free(void* ptr, const char* file, const char* func, /* Aliasing user-facing names to tracking functions: */ -# define ck_alloc(_p1) TRK_ck_alloc(_p1, __FILE__, __FUNCTION__, __LINE__) +#define ck_alloc(_p1) TRK_ck_alloc(_p1, __FILE__, __FUNCTION__, __LINE__) #define ck_alloc_nozero(_p1) TRK_ck_alloc(_p1, __FILE__, __FUNCTION__, __LINE__) -# define ck_realloc(_p1, _p2)\ +#define ck_realloc(_p1, _p2) \ TRK_ck_realloc(_p1, _p2, __FILE__, __FUNCTION__, __LINE__) -# define ck_realloc_block(_p1, _p2)\ +#define ck_realloc_block(_p1, _p2) \ TRK_ck_realloc_block(_p1, _p2, __FILE__, __FUNCTION__, __LINE__) -# define ck_strdup(_p1) TRK_ck_strdup(_p1, __FILE__, __FUNCTION__, __LINE__) +#define ck_strdup(_p1) TRK_ck_strdup(_p1, __FILE__, __FUNCTION__, __LINE__) -# define ck_memdup(_p1, _p2)\ +#define ck_memdup(_p1, _p2) \ TRK_ck_memdup(_p1, _p2, __FILE__, __FUNCTION__, __LINE__) -# define ck_memdup_str(_p1, _p2)\ +#define ck_memdup_str(_p1, _p2) \ TRK_ck_memdup_str(_p1, _p2, __FILE__, __FUNCTION__, __LINE__) -# define ck_free(_p1) TRK_ck_free(_p1, __FILE__, __FUNCTION__, __LINE__) +#define ck_free(_p1) TRK_ck_free(_p1, __FILE__, __FUNCTION__, __LINE__) #endif /* ^!DEBUG_BUILD */ diff --git a/include/android-ashmem.h b/include/android-ashmem.h index a4b5bf30..02a84d11 100644 --- a/include/android-ashmem.h +++ b/include/android-ashmem.h @@ -8,10 +8,10 @@ #include <sys/mman.h> #if __ANDROID_API__ >= 26 -# define shmat bionic_shmat -# define shmctl bionic_shmctl -# define shmdt bionic_shmdt -# define shmget bionic_shmget +#define shmat bionic_shmat +#define shmctl bionic_shmctl +#define shmdt bionic_shmdt +#define shmget bionic_shmget #endif #include <sys/shm.h> #undef shmat diff --git a/include/config.h b/include/config.h index babba3bd..d85a503d 100644 --- a/include/config.h +++ b/include/config.h @@ -50,9 +50,9 @@ /* Default memory limit for child process (MB): */ #ifndef __x86_64__ -# define MEM_LIMIT 25 +#define MEM_LIMIT 25 #else -# define MEM_LIMIT 50 +#define MEM_LIMIT 50 #endif /* ^!__x86_64__ */ /* Default memory limit when running in QEMU mode (MB): */ diff --git a/include/debug.h b/include/debug.h index 6a59ad7a..5ff2e23e 100644 --- a/include/debug.h +++ b/include/debug.h @@ -28,77 +28,77 @@ #ifdef USE_COLOR -# define cBLK "\x1b[0;30m" -# define cRED "\x1b[0;31m" -# define cGRN "\x1b[0;32m" -# define cBRN "\x1b[0;33m" -# define cBLU "\x1b[0;34m" -# define cMGN "\x1b[0;35m" -# define cCYA "\x1b[0;36m" -# define cLGR "\x1b[0;37m" -# define cGRA "\x1b[1;90m" -# define cLRD "\x1b[1;91m" -# define cLGN "\x1b[1;92m" -# define cYEL "\x1b[1;93m" -# define cLBL "\x1b[1;94m" -# define cPIN "\x1b[1;95m" -# define cLCY "\x1b[1;96m" -# define cBRI "\x1b[1;97m" -# define cRST "\x1b[0m" - -# define bgBLK "\x1b[40m" -# define bgRED "\x1b[41m" -# define bgGRN "\x1b[42m" -# define bgBRN "\x1b[43m" -# define bgBLU "\x1b[44m" -# define bgMGN "\x1b[45m" -# define bgCYA "\x1b[46m" -# define bgLGR "\x1b[47m" -# define bgGRA "\x1b[100m" -# define bgLRD "\x1b[101m" -# define bgLGN "\x1b[102m" -# define bgYEL "\x1b[103m" -# define bgLBL "\x1b[104m" -# define bgPIN "\x1b[105m" -# define bgLCY "\x1b[106m" -# define bgBRI "\x1b[107m" +#define cBLK "\x1b[0;30m" +#define cRED "\x1b[0;31m" +#define cGRN "\x1b[0;32m" +#define cBRN "\x1b[0;33m" +#define cBLU "\x1b[0;34m" +#define cMGN "\x1b[0;35m" +#define cCYA "\x1b[0;36m" +#define cLGR "\x1b[0;37m" +#define cGRA "\x1b[1;90m" +#define cLRD "\x1b[1;91m" +#define cLGN "\x1b[1;92m" +#define cYEL "\x1b[1;93m" +#define cLBL "\x1b[1;94m" +#define cPIN "\x1b[1;95m" +#define cLCY "\x1b[1;96m" +#define cBRI "\x1b[1;97m" +#define cRST "\x1b[0m" + +#define bgBLK "\x1b[40m" +#define bgRED "\x1b[41m" +#define bgGRN "\x1b[42m" +#define bgBRN "\x1b[43m" +#define bgBLU "\x1b[44m" +#define bgMGN "\x1b[45m" +#define bgCYA "\x1b[46m" +#define bgLGR "\x1b[47m" +#define bgGRA "\x1b[100m" +#define bgLRD "\x1b[101m" +#define bgLGN "\x1b[102m" +#define bgYEL "\x1b[103m" +#define bgLBL "\x1b[104m" +#define bgPIN "\x1b[105m" +#define bgLCY "\x1b[106m" +#define bgBRI "\x1b[107m" #else -# define cBLK "" -# define cRED "" -# define cGRN "" -# define cBRN "" -# define cBLU "" -# define cMGN "" -# define cCYA "" -# define cLGR "" -# define cGRA "" -# define cLRD "" -# define cLGN "" -# define cYEL "" -# define cLBL "" -# define cPIN "" -# define cLCY "" -# define cBRI "" -# define cRST "" - -# define bgBLK "" -# define bgRED "" -# define bgGRN "" -# define bgBRN "" -# define bgBLU "" -# define bgMGN "" -# define bgCYA "" -# define bgLGR "" -# define bgGRA "" -# define bgLRD "" -# define bgLGN "" -# define bgYEL "" -# define bgLBL "" -# define bgPIN "" -# define bgLCY "" -# define bgBRI "" +#define cBLK "" +#define cRED "" +#define cGRN "" +#define cBRN "" +#define cBLU "" +#define cMGN "" +#define cCYA "" +#define cLGR "" +#define cGRA "" +#define cLRD "" +#define cLGN "" +#define cYEL "" +#define cLBL "" +#define cPIN "" +#define cLCY "" +#define cBRI "" +#define cRST "" + +#define bgBLK "" +#define bgRED "" +#define bgGRN "" +#define bgBRN "" +#define bgBLU "" +#define bgMGN "" +#define bgCYA "" +#define bgLGR "" +#define bgGRA "" +#define bgLRD "" +#define bgLGN "" +#define bgYEL "" +#define bgLBL "" +#define bgPIN "" +#define bgLCY "" +#define bgBRI "" #endif /* ^USE_COLOR */ @@ -108,39 +108,39 @@ #ifdef FANCY_BOXES -# define SET_G1 "\x1b)0" /* Set G1 for box drawing */ -# define RESET_G1 "\x1b)B" /* Reset G1 to ASCII */ -# define bSTART "\x0e" /* Enter G1 drawing mode */ -# define bSTOP "\x0f" /* Leave G1 drawing mode */ -# define bH "q" /* Horizontal line */ -# define bV "x" /* Vertical line */ -# define bLT "l" /* Left top corner */ -# define bRT "k" /* Right top corner */ -# define bLB "m" /* Left bottom corner */ -# define bRB "j" /* Right bottom corner */ -# define bX "n" /* Cross */ -# define bVR "t" /* Vertical, branch right */ -# define bVL "u" /* Vertical, branch left */ -# define bHT "v" /* Horizontal, branch top */ -# define bHB "w" /* Horizontal, branch bottom */ +#define SET_G1 "\x1b)0" /* Set G1 for box drawing */ +#define RESET_G1 "\x1b)B" /* Reset G1 to ASCII */ +#define bSTART "\x0e" /* Enter G1 drawing mode */ +#define bSTOP "\x0f" /* Leave G1 drawing mode */ +#define bH "q" /* Horizontal line */ +#define bV "x" /* Vertical line */ +#define bLT "l" /* Left top corner */ +#define bRT "k" /* Right top corner */ +#define bLB "m" /* Left bottom corner */ +#define bRB "j" /* Right bottom corner */ +#define bX "n" /* Cross */ +#define bVR "t" /* Vertical, branch right */ +#define bVL "u" /* Vertical, branch left */ +#define bHT "v" /* Horizontal, branch top */ +#define bHB "w" /* Horizontal, branch bottom */ #else -# define SET_G1 "" -# define RESET_G1 "" -# define bSTART "" -# define bSTOP "" -# define bH "-" -# define bV "|" -# define bLT "+" -# define bRT "+" -# define bLB "+" -# define bRB "+" -# define bX "+" -# define bVR "+" -# define bVL "+" -# define bHT "+" -# define bHB "+" +#define SET_G1 "" +#define RESET_G1 "" +#define bSTART "" +#define bSTOP "" +#define bH "-" +#define bV "|" +#define bLT "+" +#define bRT "+" +#define bLB "+" +#define bRB "+" +#define bX "+" +#define bVR "+" +#define bVL "+" +#define bHT "+" +#define bHB "+" #endif /* ^FANCY_BOXES */ @@ -161,9 +161,9 @@ /* Just print stuff to the appropriate stream. */ #ifdef MESSAGES_TO_STDOUT -# define SAYF(x...) printf(x) +#define SAYF(x...) printf(x) #else -# define SAYF(x...) fprintf(stderr, x) +#define SAYF(x...) fprintf(stderr, x) #endif /* ^MESSAGES_TO_STDOUT */ /* Show a prefixed warning. */ diff --git a/include/forkserver.h b/include/forkserver.h index af5dab72..bfc35800 100644 --- a/include/forkserver.h +++ b/include/forkserver.h @@ -5,20 +5,20 @@ void handle_timeout(int sig); void init_forkserver(char **argv); #ifdef __APPLE__ -# define MSG_FORK_ON_APPLE \ +#define MSG_FORK_ON_APPLE \ " - On MacOS X, the semantics of fork() syscalls are non-standard and " \ "may\n" \ " break afl-fuzz performance optimizations when running " \ "platform-specific\n" \ " targets. To fix this, set AFL_NO_FORKSRV=1 in the environment.\n\n" #else -# define MSG_FORK_ON_APPLE "" +#define MSG_FORK_ON_APPLE "" #endif #ifdef RLIMIT_AS -# define MSG_ULIMIT_USAGE " ( ulimit -Sv $[%llu << 10];" +#define MSG_ULIMIT_USAGE " ( ulimit -Sv $[%llu << 10];" #else -# define MSG_ULIMIT_USAGE " ( ulimit -Sd $[%llu << 10];" +#define MSG_ULIMIT_USAGE " ( ulimit -Sd $[%llu << 10];" #endif /* ^RLIMIT_AS */ #endif diff --git a/include/hash.h b/include/hash.h index 5d0512a6..f60839ea 100644 --- a/include/hash.h +++ b/include/hash.h @@ -31,7 +31,7 @@ #ifdef __x86_64__ -# define ROL64(_x, _r) ((((u64)(_x)) << (_r)) | (((u64)(_x)) >> (64 - (_r)))) +#define ROL64(_x, _r) ((((u64)(_x)) << (_r)) | (((u64)(_x)) >> (64 - (_r)))) static inline u32 hash32(const void* key, u32 len, u32 seed) { @@ -66,7 +66,7 @@ static inline u32 hash32(const void* key, u32 len, u32 seed) { #else -# define ROL32(_x, _r) ((((u32)(_x)) << (_r)) | (((u32)(_x)) >> (32 - (_r)))) +#define ROL32(_x, _r) ((((u32)(_x)) << (_r)) | (((u32)(_x)) >> (32 - (_r)))) static inline u32 hash32(const void* key, u32 len, u32 seed) { diff --git a/include/types.h b/include/types.h index 60ae64c2..dba666b6 100644 --- a/include/types.h +++ b/include/types.h @@ -52,8 +52,8 @@ typedef int32_t s32; typedef int64_t s64; #ifndef MIN -# define MIN(_a, _b) ((_a) > (_b) ? (_b) : (_a)) -# define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) +#define MIN(_a, _b) ((_a) > (_b) ? (_b) : (_a)) +#define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) #endif /* !MIN */ #define SWAP16(_x) \ @@ -74,9 +74,9 @@ typedef int64_t s64; }) #ifdef AFL_LLVM_PASS -# define AFL_R(x) (random() % (x)) +#define AFL_R(x) (random() % (x)) #else -# define R(x) (random() % (x)) +#define R(x) (random() % (x)) #endif /* ^AFL_LLVM_PASS */ #define STRINGIFY_INTERNAL(x) #x @@ -85,11 +85,11 @@ typedef int64_t s64; #define MEM_BARRIER() __asm__ volatile("" ::: "memory") #if __GNUC__ < 6 -# define likely(_x) (_x) -# define unlikely(_x) (_x) +#define likely(_x) (_x) +#define unlikely(_x) (_x) #else -# define likely(_x) __builtin_expect(!!(_x), 1) -# define unlikely(_x) __builtin_expect(!!(_x), 0) +#define likely(_x) __builtin_expect(!!(_x), 1) +#define unlikely(_x) __builtin_expect(!!(_x), 0) #endif #endif /* ! _HAVE_TYPES_H */ diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index 5104fed4..256506be 100644 --- a/libdislocator/libdislocator.so.c +++ b/libdislocator/libdislocator.so.c @@ -29,11 +29,11 @@ #include "types.h" #ifndef PAGE_SIZE -# define PAGE_SIZE 4096 +#define PAGE_SIZE 4096 #endif /* !PAGE_SIZE */ #ifndef MAP_ANONYMOUS -# define MAP_ANONYMOUS MAP_ANON +#define MAP_ANONYMOUS MAP_ANON #endif /* !MAP_ANONYMOUS */ /* Error / message handling: */ diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c index fa26447e..51c36c4d 100644 --- a/libtokencap/libtokencap.so.c +++ b/libtokencap/libtokencap.so.c @@ -27,7 +27,7 @@ #include "../config.h" #ifndef __linux__ -# error "Sorry, this library is Linux-specific for now!" +#error "Sorry, this library is Linux-specific for now!" #endif /* !__linux__ */ /* Mapping data and such */ diff --git a/llvm_mode/MarkNodes.h b/llvm_mode/MarkNodes.h index 23316652..8ddc978d 100644 --- a/llvm_mode/MarkNodes.h +++ b/llvm_mode/MarkNodes.h @@ -1,9 +1,9 @@ #ifndef __MARK_NODES__ -# define __MARK_NODES__ +#define __MARK_NODES__ -# include "llvm/IR/BasicBlock.h" -# include "llvm/IR/Function.h" -# include <vector> +#include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Function.h" +#include <vector> std::pair<std::vector<llvm::BasicBlock *>, std::vector<llvm::BasicBlock *>> markNodes(llvm::Function *F); diff --git a/llvm_mode/afl-llvm-rt.o.c b/llvm_mode/afl-llvm-rt.o.c index bc38f1ec..8d435d21 100644 --- a/llvm_mode/afl-llvm-rt.o.c +++ b/llvm_mode/afl-llvm-rt.o.c @@ -20,7 +20,7 @@ */ #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" #include "types.h" @@ -42,9 +42,9 @@ the LLVM-generated runtime initialization pass, not before. */ #ifdef USE_TRACE_PC -# define CONST_PRIO 5 +#define CONST_PRIO 5 #else -# define CONST_PRIO 0 +#define CONST_PRIO 0 #endif /* ^USE_TRACE_PC */ #include <sys/mman.h> diff --git a/qemu_mode/libcompcov/libcompcov.so.c b/qemu_mode/libcompcov/libcompcov.so.c index e758c034..9d61848e 100644 --- a/qemu_mode/libcompcov/libcompcov.so.c +++ b/qemu_mode/libcompcov/libcompcov.so.c @@ -33,7 +33,7 @@ #include "pmparser.h" #ifndef __linux__ -# error "Sorry, this library is Linux-specific for now!" +#error "Sorry, this library is Linux-specific for now!" #endif /* !__linux__ */ /* Change this value to tune the compare coverage */ diff --git a/qemu_mode/libcompcov/pmparser.h b/qemu_mode/libcompcov/pmparser.h index 91dfd032..e7fcf187 100644 --- a/qemu_mode/libcompcov/pmparser.h +++ b/qemu_mode/libcompcov/pmparser.h @@ -13,19 +13,19 @@ implied warranty. */ #ifndef H_PMPARSER -# define H_PMPARSER -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <string.h> -# include <sys/types.h> -# include <sys/stat.h> -# include <fcntl.h> -# include <errno.h> -# include <linux/limits.h> +#define H_PMPARSER +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <linux/limits.h> // maximum line length in a procmaps file -# define PROCMAPS_LINE_MAX_LENGTH (PATH_MAX + 100) +#define PROCMAPS_LINE_MAX_LENGTH (PATH_MAX + 100) /** * procmaps_struct * @desc hold all the information about an area in the process's VM diff --git a/qemu_mode/patches/afl-qemu-common.h b/qemu_mode/patches/afl-qemu-common.h index c87bacb6..88c110b4 100644 --- a/qemu_mode/patches/afl-qemu-common.h +++ b/qemu_mode/patches/afl-qemu-common.h @@ -36,7 +36,7 @@ /* NeverZero */ #if (defined(__x86_64__) || defined(__i386__)) && defined(AFL_QEMU_NOT_ZERO) -# define INC_AFL_AREA(loc) \ +#define INC_AFL_AREA(loc) \ asm volatile( \ "incb (%0, %1, 1)\n" \ "adcb $0, (%0, %1, 1)\n" \ @@ -44,6 +44,6 @@ : "r"(afl_area_ptr), "r"(loc) \ : "memory", "eax") #else -# define INC_AFL_AREA(loc) afl_area_ptr[loc]++ +#define INC_AFL_AREA(loc) afl_area_ptr[loc]++ #endif diff --git a/src/afl-analyze.c b/src/afl-analyze.c index e3014256..4cfebe3b 100644 --- a/src/afl-analyze.c +++ b/src/afl-analyze.c @@ -22,7 +22,7 @@ #define AFL_MAIN #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" #include "types.h" diff --git a/src/afl-as.c b/src/afl-as.c index 57f4c4a3..96b00d37 100644 --- a/src/afl-as.c +++ b/src/afl-as.c @@ -74,9 +74,9 @@ static u8 use_64bit = 1; static u8 use_64bit = 0; -# ifdef __APPLE__ -# error "Sorry, 32-bit Apple platforms are not supported." -# endif /* __APPLE__ */ +#ifdef __APPLE__ +#error "Sorry, 32-bit Apple platforms are not supported." +#endif /* __APPLE__ */ #endif /* ^__x86_64__ */ diff --git a/src/afl-common.c b/src/afl-common.c index 9f1f45eb..69c1a77d 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -13,7 +13,7 @@ /* Detect @@ in args. */ #ifndef __glibc__ -# include <unistd.h> +#include <unistd.h> #endif void detect_file_args(char** argv, u8* prog_in) { diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index 8a3ee6fa..8588dde7 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -1491,25 +1491,25 @@ void get_core_count(void) { /* On *BSD systems, we can just use a sysctl to get the number of CPUs. */ -# ifdef __APPLE__ +#ifdef __APPLE__ if (sysctlbyname("hw.logicalcpu", &cpu_core_count, &s, NULL, 0) < 0) return; -# else +#else int s_name[2] = {CTL_HW, HW_NCPU}; if (sysctl(s_name, 2, &cpu_core_count, &s, NULL, 0) < 0) return; -# endif /* ^__APPLE__ */ +#endif /* ^__APPLE__ */ #else -# ifdef HAVE_AFFINITY +#ifdef HAVE_AFFINITY cpu_core_count = sysconf(_SC_NPROCESSORS_ONLN); -# else +#else FILE* f = fopen("/proc/stat", "r"); u8 tmp[1024]; @@ -1521,7 +1521,7 @@ void get_core_count(void) { fclose(f); -# endif /* ^HAVE_AFFINITY */ +#endif /* ^HAVE_AFFINITY */ #endif /* ^(__APPLE__ || __FreeBSD__ || __OpenBSD__) */ @@ -1772,10 +1772,10 @@ void check_binary(u8* fname) { #else -# if !defined(__arm__) && !defined(__arm64__) +#if !defined(__arm__) && !defined(__arm64__) if (f_data[0] != 0xCF || f_data[1] != 0xFA || f_data[2] != 0xED) FATAL("Program '%s' is not a 64-bit Mach-O binary", target_path); -# endif +#endif #endif /* ^!__APPLE__ */ diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c index 1b7abedd..bc63c226 100644 --- a/src/afl-fuzz-one.c +++ b/src/afl-fuzz-one.c @@ -2242,11 +2242,11 @@ retry_splicing: out_buf = ck_alloc_nozero(len); memcpy(out_buf, in_buf, len); -# ifdef USE_PYTHON +#ifdef USE_PYTHON goto python_stage; -# else +#else goto havoc_stage; -# endif +#endif } diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 685840c6..d04058ca 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -27,10 +27,10 @@ static void usage(u8* argv0) { #ifdef USE_PYTHON -# define PHYTON_SUPPORT\ +#define PHYTON_SUPPORT \ "Compiled with Python 2.7 module support, see docs/python_mutators.txt\n" #else -# define PHYTON_SUPPORT "" +#define PHYTON_SUPPORT "" #endif SAYF( @@ -616,9 +616,9 @@ int main(int argc, char** argv) { get_core_count(); -# ifdef HAVE_AFFINITY +#ifdef HAVE_AFFINITY bind_to_free_cpu(); -# endif /* HAVE_AFFINITY */ +#endif /* HAVE_AFFINITY */ check_crash_handling(); check_cpu_governor(); @@ -635,12 +635,12 @@ int main(int argc, char** argv) { setup_dirs_fds(); -# ifdef USE_PYTHON +#ifdef USE_PYTHON if (init_py()) FATAL("Failed to initialize Python module"); -# else +#else if (getenv("AFL_PYTHON_MODULE")) FATAL("Your AFL binary was built without Python support"); -# endif +#endif setup_cmdline_file(argv + optind); @@ -867,9 +867,9 @@ stop_fuzzing: alloc_report(); -# ifdef USE_PYTHON +#ifdef USE_PYTHON finalize_py(); -# endif +#endif OKF("We're done here. Have a nice day!\n"); diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c index 5aa9b35c..fd96d25d 100644 --- a/src/afl-gotcpu.c +++ b/src/afl-gotcpu.c @@ -27,11 +27,11 @@ #define AFL_MAIN #ifndef _GNU_SOURCE -# define _GNU_SOURCE +#define _GNU_SOURCE #endif #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include <stdio.h> #include <stdlib.h> @@ -48,7 +48,7 @@ #include "debug.h" #ifdef __linux__ -# define HAVE_AFFINITY 1 +#define HAVE_AFFINITY 1 #endif /* __linux__ */ /* Get unix time in microseconds. */ diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c index 9c7ac7c3..60764779 100644 --- a/src/afl-sharedmem.c +++ b/src/afl-sharedmem.c @@ -5,7 +5,7 @@ #define AFL_MAIN #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" #include "types.h" @@ -32,8 +32,8 @@ #include <sys/mman.h> #ifndef USEMMAP -# include <sys/ipc.h> -# include <sys/shm.h> +#include <sys/ipc.h> +#include <sys/shm.h> #endif extern unsigned char *trace_bits; diff --git a/src/afl-showmap.c b/src/afl-showmap.c index ac3d687d..5c367339 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -24,7 +24,7 @@ #define AFL_MAIN #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" #include "types.h" diff --git a/src/afl-tmin.c b/src/afl-tmin.c index 9decdb4d..ce4a3d76 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -22,7 +22,7 @@ #define AFL_MAIN #ifdef __ANDROID__ -# include "android-ashmem.h" +#include "android-ashmem.h" #endif #include "config.h" diff --git a/unicorn_mode/patches/afl-unicorn-common.h b/unicorn_mode/patches/afl-unicorn-common.h index d5038d06..fd88e21b 100644 --- a/unicorn_mode/patches/afl-unicorn-common.h +++ b/unicorn_mode/patches/afl-unicorn-common.h @@ -35,7 +35,7 @@ /* NeverZero */ #if (defined(__x86_64__) || defined(__i386__)) && defined(AFL_QEMU_NOT_ZERO) -# define INC_AFL_AREA(loc) \ +#define INC_AFL_AREA(loc) \ asm volatile( \ "incb (%0, %1, 1)\n" \ "adcb $0, (%0, %1, 1)\n" \ @@ -43,6 +43,6 @@ : "r"(afl_area_ptr), "r"(loc) \ : "memory", "eax") #else -# define INC_AFL_AREA(loc) afl_area_ptr[loc]++ +#define INC_AFL_AREA(loc) afl_area_ptr[loc]++ #endif |