fix warning, code format
MODIFY
include/alloc-inl.h
include/alloc-inl.h
# define alloc_printf(_str...) \
({ \
- \
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); \
_tmp; \
- \
+
})
/* Macro to enforce allocation limits as a last-resort defense against
# define ALLOC_CHECK_SIZE(_s) \
do { \
- \
if ((_s) > MAX_ALLOC) ABORT("Bad alloc request: %u bytes", (_s)); \
\
+
} while (0)
/* Macro to check malloc() failures and the like. */
# define ALLOC_CHECK_RESULT(_r, _s) \
do { \
- \
if (!(_r)) ABORT("Out of memory: can't allocate %u bytes", (_s)); \
\
+
} while (0)
/* Allocator increments for ck_realloc_block(). */
@@ -235,14 +234,13 @@ static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) {
# define alloc_printf(_str...) \
({ \
- \
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); \
_tmp; \
- \
+
})
/* Macro to enforce allocation limits as a last-resort defense against
@@ -250,18 +248,18 @@ static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) {
# define ALLOC_CHECK_SIZE(_s) \
do { \
- \
if ((_s) > MAX_ALLOC) ABORT("Bad alloc request: %u bytes", (_s)); \
\
+
} while (0)
/* Macro to check malloc() failures and the like. */
# define ALLOC_CHECK_RESULT(_r, _s) \
do { \
- \
if (!(_r)) ABORT("Out of memory: can't allocate %u bytes", (_s)); \
\
+
} while (0)
/* Magic tokens used to mark used / freed chunks. */
@@ -287,31 +285,30 @@ static inline u8 *DFL_ck_memdup_str(u8 *mem, u32 size) {
# 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."); \
- \
+
} \
+
\
+
} while (0)
# define CHECK_PTR_EXPR(_p) \
({ \
- \
typeof(_p) _tmp = (_p); \
CHECK_PTR(_tmp); \
_tmp; \
- \
+
})
/* Allocate a buffer, explicitly not zeroing it. Returns NULL for zero-sized
@@ -745,7 +742,8 @@ static inline void TRK_ck_free(void *ptr, const char *file, const char *func,
# 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_alloc_nozero(_p1) \
+ TRK_ck_alloc(_p1, __FILE__, __FUNCTION__, __LINE__)
# define ck_realloc(_p1, _p2) \
TRK_ck_realloc(_p1, _p2, __FILE__, __FUNCTION__, __LINE__)

MODIFY
include/types.h
include/types.h
@@ -83,20 +83,20 @@ typedef int64_t s64;
#ifndef MIN
# define MIN(a, b) \
({ \
- \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
- _a < _b ? _a : _b; \
- \
+ _a < _b ? _a : _b;
+
})
+
# define MAX(a, b) \
({ \
- \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
- _a > _b ? _a : _b; \
- \
+ _a > _b ? _a : _b;
+
})
+
#endif /* !MIN */
#define SWAP16(_x) \

MODIFY
libdislocator/libdislocator.so.c
libdislocator/libdislocator.so.c
# ifdef __NR_getrandom
# define arc4random_buf(p, l) \
do { \
- \
ssize_t rd = syscall(__NR_getrandom, p, l, 0); \
if (rd != l) DEBUGF("getrandom failed"); \
\
+
} while (0)
# else
# include <time.h>
# define arc4random_buf(p, l) \
do { \
- \
srand(time(NULL)); \
u32 i; \
u8 *ptr = (u8 *)p; \
for (i = 0; i < l; i++) \
ptr[i] = rand() % INT_MAX; \
\
+
} while (0)
# endif

MODIFY
llvm_mode/LLVMInsTrim.so.cc
llvm_mode/LLVMInsTrim.so.cc
@@ -137,13 +137,13 @@ struct InsTrim : public ModulePass {
getenv("AFL_LLVM_SKIPSINGLEBLOCK"))
function_minimum_size = 2;
- unsigned PrevLocSize = 0;
+ unsigned int PrevLocSize = 0;
char * ngram_size_str = getenv("AFL_LLVM_NGRAM_SIZE");
if (!ngram_size_str) ngram_size_str = getenv("AFL_NGRAM_SIZE");
char *ctx_str = getenv("AFL_LLVM_CTX");
#ifdef AFL_HAVE_VECTOR_INTRINSICS
- int ngram_size = 0;
+ unsigned int ngram_size = 0;
/* Decide previous location vector size (must be a power of two) */
VectorType *PrevLocTy;

fix warning, code format