warn on _AFL and __AFL env vars
MODIFY
include/alloc-inl.h
include/alloc-inl.h
@@ -363,7 +363,8 @@ static inline void *DFL_ck_realloc(void *orig, u32 size) {
if (orig) {
- memcpy((char *)ret + ALLOC_OFF_HEAD, (char *)orig + ALLOC_OFF_HEAD, MIN(size, old_size));
+ memcpy((char *)ret + ALLOC_OFF_HEAD, (char *)orig + ALLOC_OFF_HEAD,
+ MIN(size, old_size));
memset((char *)orig + ALLOC_OFF_HEAD, 0xFF, old_size);
ALLOC_C1((char *)orig + ALLOC_OFF_HEAD) = ALLOC_MAGIC_F;

MODIFY
src/afl-analyze.c
src/afl-analyze.c
@@ -121,6 +121,7 @@ static u8 count_class_lookup[256] = {
[128] = TIMES64(128)
};
+
#undef TIMES64
#undef TIMES32
#undef TIMES16

MODIFY
src/afl-common.c
src/afl-common.c
@@ -432,7 +432,9 @@ void check_environment_vars(char **envp) {
char *env, *val;
while ((env = envp[index++]) != NULL) {
- if (strncmp(env, "ALF_", 4) == 0) {
+ if (strncmp(env, "ALF_", 4) == 0 || strncmp(env, "_ALF", 4) == 0 ||
+ strncmp(env, "__ALF", 5) == 0 || strncmp(env, "_AFL", 4) == 0 ||
+ strncmp(env, "__AFL", 5) == 0) {
WARNF("Potentially mistyped AFL environment variable: %s", env);
issue_detected = 1;

MODIFY
src/afl-fuzz-bitmap.c
src/afl-fuzz-bitmap.c
@@ -148,7 +148,9 @@ u32 count_non_255_bytes(afl_state_t *afl, u8 *mem) {
#define TIMES16(x) TIMES8(x), TIMES8(x)
#define TIMES32(x) TIMES16(x), TIMES16(x)
#define TIMES64(x) TIMES32(x), TIMES32(x)
-#define TIMES255(x) TIMES64(x),TIMES64(x),TIMES64(x),TIMES32(x),TIMES16(x),TIMES8(x),TIMES4(x),x,x,x
+#define TIMES255(x) \
+ TIMES64(x), TIMES64(x), TIMES64(x), TIMES32(x), TIMES16(x), TIMES8(x), \
+ TIMES4(x), x, x, x
const u8 simplify_lookup[256] = {
[0] = 1, [1] = TIMES255(128)
@@ -172,6 +174,7 @@ const u8 count_class_lookup8[256] = {
[128] = TIMES64(128)
};
+
#undef TIMES255
#undef TIMES64
#undef TIMES32

MODIFY
src/afl-showmap.c
src/afl-showmap.c
@@ -107,8 +107,14 @@ static sharedmem_t * shm_fuzz;
#define TIMES128(x) TIMES64(x), TIMES64(x)
static const u8 count_class_human[256] = {
- [0] = 0, [1] = 1, [2] = 2, [3] = 3,
- [4] = TIMES4(4), [8] = TIMES8(5),[16] = TIMES16(6),[32] = TIMES96(7),
+ [0] = 0,
+ [1] = 1,
+ [2] = 2,
+ [3] = 3,
+ [4] = TIMES4(4),
+ [8] = TIMES8(5),
+ [16] = TIMES16(6),
+ [32] = TIMES96(7),
[128] = TIMES128(8)
};
@@ -126,6 +132,7 @@ static const u8 count_class_binary[256] = {
[128] = TIMES64(128)
};
+
#undef TIMES128
#undef TIMES96
#undef TIMES64

MODIFY
src/afl-tmin.c
src/afl-tmin.c
@@ -116,6 +116,7 @@ static const u8 count_class_lookup[256] = {
[128] = TIMES64(128)
};
+
#undef TIMES64
#undef TIMES32
#undef TIMES16

warn on _AFL and __AFL env vars