about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2024-07-14 11:23:51 +0200
committerGitHub <noreply@github.com>2024-07-14 11:23:51 +0200
commit19ca7b3761f5abff8b72770d6bbfbde80ef5b985 (patch)
tree62e6316d91ea348228fe3471bfa59ee01e0e393e /src
parent53409530b369e560c7f6f37ead5a5db9e116efd0 (diff)
parent55a2362348cd467b65d6aea33e93ec44c6de1a38 (diff)
downloadafl++-19ca7b3761f5abff8b72770d6bbfbde80ef5b985.tar.gz
Merge pull request #2158 from AFLplusplus/dev
push to stable
Diffstat (limited to 'src')
-rw-r--r--src/afl-common.c2
-rw-r--r--src/afl-forkserver.c1
-rw-r--r--src/afl-fuzz-extras.c4
-rw-r--r--src/afl-fuzz-init.c6
-rw-r--r--src/afl-fuzz.c21
5 files changed, 16 insertions, 18 deletions
diff --git a/src/afl-common.c b/src/afl-common.c
index efdb5d60..04a984cb 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -979,6 +979,7 @@ inline u64 get_cur_time(void) {
   struct timeval  tv;
   struct timezone tz;
 
+  // TO NOT REPLACE WITH clock_gettime!!!
   gettimeofday(&tv, &tz);
 
   return (tv.tv_sec * 1000ULL) + (tv.tv_usec / 1000);
@@ -992,6 +993,7 @@ inline u64 get_cur_time_us(void) {
   struct timeval  tv;
   struct timezone tz;
 
+  // TO NOT REPLACE WITH clock_gettime!!!
   gettimeofday(&tv, &tz);
 
   return (tv.tv_sec * 1000000ULL) + tv.tv_usec;
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index cec91f76..6366f473 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -241,6 +241,7 @@ void afl_fsrv_init(afl_forkserver_t *fsrv) {
   fsrv->mem_limit = MEM_LIMIT;
   fsrv->out_file = NULL;
   fsrv->child_kill_signal = SIGKILL;
+  fsrv->max_length = MAX_FILE;
 
   /* exec related stuff */
   fsrv->child_pid = -1;
diff --git a/src/afl-fuzz-extras.c b/src/afl-fuzz-extras.c
index 55b6be04..da996602 100644
--- a/src/afl-fuzz-extras.c
+++ b/src/afl-fuzz-extras.c
@@ -455,13 +455,13 @@ void deunicode_extras(afl_state_t *afl) {
 
         case 2:
           if (!afl->extras[i].data[j]) { ++z3; }
-          // fall through
+          __attribute__((fallthrough));
         case 0:
           if (!afl->extras[i].data[j]) { ++z1; }
           break;
         case 3:
           if (!afl->extras[i].data[j]) { ++z4; }
-          // fall through
+          __attribute__((fallthrough));
         case 1:
           if (!afl->extras[i].data[j]) { ++z2; }
           break;
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 98de26dd..4f366b0d 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -2717,7 +2717,11 @@ void fix_up_sync(afl_state_t *afl) {
 
   }
 
-  if (strlen(afl->sync_id) > 32) { FATAL("Fuzzer ID too long"); }
+  if (strlen(afl->sync_id) > 50) {
+
+    FATAL("sync_id max length is 50 characters");
+
+  }
 
   x = alloc_printf("%s/%s", afl->out_dir, afl->sync_id);
 
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 8a84d447..9867eba3 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -1610,17 +1610,7 @@ int main(int argc, char **argv_orig, char **envp) {
 
   #endif
 
-  if (afl->sync_id) {
-
-    if (strlen(afl->sync_id) > 50) {
-
-      FATAL("sync_id max length is 50 characters");
-
-    }
-
-    fix_up_sync(afl);
-
-  }
+  if (afl->sync_id) { fix_up_sync(afl); }
 
   if (!strcmp(afl->in_dir, afl->out_dir)) {
 
@@ -2815,7 +2805,7 @@ int main(int argc, char **argv_orig, char **envp) {
   // (void)nice(-20);  // does not improve the speed
 
   #ifdef INTROSPECTION
-  u32 prev_saved_crashes = 0, prev_saved_tmouts = 0;
+  u32 prev_saved_crashes = 0, prev_saved_tmouts = 0, stat_prev_queued_items = 0;
   #endif
   u32 prev_queued_items = 0, runs_in_current_cycle = (u32)-1;
   u8  skipped_fuzz;
@@ -3132,10 +3122,11 @@ int main(int argc, char **argv_orig, char **envp) {
 
       } else {
 
-        if (unlikely(afl->queued_items > prev_queued_items)) {
+        if (unlikely(afl->queued_items > stat_prev_queued_items)) {
 
-          afl->queue_cur->stats_finds += afl->queued_items - prev_queued_items;
-          prev_queued_items = afl->queued_items;
+          afl->queue_cur->stats_finds +=
+              afl->queued_items - stat_prev_queued_items;
+          stat_prev_queued_items = afl->queued_items;
 
         }