about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-12-16 12:40:35 +0100
committerGitHub <noreply@github.com>2021-12-16 12:40:35 +0100
commit74a8f145e09d0361d8f576eb3f2e8881b6116f18 (patch)
tree42a51b12f3a018e729cca0826feccd49f5536e2e /src
parent02fba1cc7e8709c8e0961454136a64f373e4f9ff (diff)
parent3cb7319ccdb98dcc6b023dbead603a4450ac4541 (diff)
downloadafl++-74a8f145e09d0361d8f576eb3f2e8881b6116f18.tar.gz
Merge pull request #1219 from AFLplusplus/dev
push to stable
Diffstat (limited to 'src')
-rw-r--r--src/afl-analyze.c21
-rw-r--r--src/afl-cc.c5
-rw-r--r--src/afl-fuzz-bitmap.c7
-rw-r--r--src/afl-showmap.c35
-rw-r--r--src/afl-tmin.c21
5 files changed, 23 insertions, 66 deletions
diff --git a/src/afl-analyze.c b/src/afl-analyze.c
index ac5a324c..86278c31 100644
--- a/src/afl-analyze.c
+++ b/src/afl-analyze.c
@@ -96,31 +96,20 @@ static afl_forkserver_t fsrv = {0};   /* The forkserver                     */
 /* Classify tuple counts. This is a slow & naive version, but good enough here.
  */
 
-#define TIMES4(x) x, x, x, x
-#define TIMES8(x) TIMES4(x), TIMES4(x)
-#define TIMES16(x) TIMES8(x), TIMES8(x)
-#define TIMES32(x) TIMES16(x), TIMES16(x)
-#define TIMES64(x) TIMES32(x), TIMES32(x)
 static u8 count_class_lookup[256] = {
 
     [0] = 0,
     [1] = 1,
     [2] = 2,
     [3] = 4,
-    [4] = TIMES4(8),
-    [8] = TIMES8(16),
-    [16] = TIMES16(32),
-    [32] = TIMES32(64),
-    [128] = TIMES64(128)
+    [4 ... 7] = 8,
+    [8 ... 15] = 16,
+    [16 ... 31] = 32,
+    [32 ... 127] = 64,
+    [128 ... 255] = 128
 
 };
 
-#undef TIMES64
-#undef TIMES32
-#undef TIMES16
-#undef TIMES8
-#undef TIMES4
-
 static void kill_child() {
 
   if (fsrv.child_pid > 0) {
diff --git a/src/afl-cc.c b/src/afl-cc.c
index cafb8e32..442cf265 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -695,7 +695,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
   /* Detect stray -v calls from ./configure scripts. */
 
-  u8 skip_next = 0;
+  u8 skip_next = 0, non_dash = 0;
   while (--argc) {
 
     u8 *cur = *(++argv);
@@ -707,6 +707,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
     }
 
+    if (cur[0] != '-') { non_dash = 1; }
     if (!strncmp(cur, "--afl", 5)) continue;
     if (lto_mode && !strncmp(cur, "-fuse-ld=", 9)) continue;
     if (lto_mode && !strncmp(cur, "--ld-path=", 10)) continue;
@@ -1025,7 +1026,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
   }
 
-  if (preprocessor_only || have_c) {
+  if (preprocessor_only || have_c || !non_dash) {
 
     /* In the preprocessor_only case (-E), we are not actually compiling at
        all but requesting the compiler to output preprocessed sources only.
diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c
index 2d88896f..7a236005 100644
--- a/src/afl-fuzz-bitmap.c
+++ b/src/afl-fuzz-bitmap.c
@@ -167,13 +167,6 @@ const u8 count_class_lookup8[256] = {
 
 };
 
-#undef TIMES255
-#undef TIMES64
-#undef TIMES32
-#undef TIMES16
-#undef TIMES8
-#undef TIMES4
-
 u16 count_class_lookup16[65536];
 
 void init_count_class16(void) {
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 8cddcb32..115f9f2a 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -103,24 +103,17 @@ static sharedmem_t *     shm_fuzz;
 /* Classify tuple counts. Instead of mapping to individual bits, as in
    afl-fuzz.c, we map to more user-friendly numbers between 1 and 8. */
 
-#define TIMES4(x) x, x, x, x
-#define TIMES8(x) TIMES4(x), TIMES4(x)
-#define TIMES16(x) TIMES8(x), TIMES8(x)
-#define TIMES32(x) TIMES16(x), TIMES16(x)
-#define TIMES64(x) TIMES32(x), TIMES32(x)
-#define TIMES96(x) TIMES64(x), TIMES32(x)
-#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),
-    [128] = TIMES128(8)
+    [4] = 4,
+    [8] = 5,
+    [16] = 6,
+    [32] = 7,
+    [128] = 8
 
 };
 
@@ -130,22 +123,14 @@ static const u8 count_class_binary[256] = {
     [1] = 1,
     [2] = 2,
     [3] = 4,
-    [4] = TIMES4(8),
-    [8] = TIMES8(16),
-    [16] = TIMES16(32),
-    [32] = TIMES32(64),
-    [128] = TIMES64(128)
+    [4 ... 7] = 8,
+    [8 ... 15] = 16,
+    [16 ... 31] = 32,
+    [32 ... 127] = 64,
+    [128 ... 255] = 128
 
 };
 
-#undef TIMES128
-#undef TIMES96
-#undef TIMES64
-#undef TIMES32
-#undef TIMES16
-#undef TIMES8
-#undef TIMES4
-
 static void kill_child() {
 
   timed_out = 1;
diff --git a/src/afl-tmin.c b/src/afl-tmin.c
index 89546c45..b5b015ce 100644
--- a/src/afl-tmin.c
+++ b/src/afl-tmin.c
@@ -95,31 +95,20 @@ static sharedmem_t *     shm_fuzz;
 /* Classify tuple counts. This is a slow & naive version, but good enough here.
  */
 
-#define TIMES4(x) x, x, x, x
-#define TIMES8(x) TIMES4(x), TIMES4(x)
-#define TIMES16(x) TIMES8(x), TIMES8(x)
-#define TIMES32(x) TIMES16(x), TIMES16(x)
-#define TIMES64(x) TIMES32(x), TIMES32(x)
 static const u8 count_class_lookup[256] = {
 
     [0] = 0,
     [1] = 1,
     [2] = 2,
     [3] = 4,
-    [4] = TIMES4(8),
-    [8] = TIMES8(16),
-    [16] = TIMES16(32),
-    [32] = TIMES32(64),
-    [128] = TIMES64(128)
+    [4 ... 7] = 8,
+    [8 ... 15] = 16,
+    [16 ... 31] = 32,
+    [32 ... 127] = 64,
+    [128 ... 255] = 128
 
 };
 
-#undef TIMES64
-#undef TIMES32
-#undef TIMES16
-#undef TIMES8
-#undef TIMES4
-
 static void kill_child() {
 
   if (fsrv->child_pid > 0) {