about summary refs log tree commit diff
path: root/include/afl-fuzz.h
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-10-12 03:18:54 +0200
committerGitHub <noreply@github.com>2020-10-12 03:18:54 +0200
commitc03fbcedaa68db5324423975a34331287426f7c2 (patch)
tree59506eb49144e61c4fcf8691cabb5b4c7ce68e96 /include/afl-fuzz.h
parentdab017dddaaab6d836a590f7bba3eea3549758d2 (diff)
parent43d8296504fc2dbb80ebbdf04072286805ae9bff (diff)
downloadafl++-c03fbcedaa68db5324423975a34331287426f7c2.tar.gz
Merge branch 'memcache_marc' into dev
Diffstat (limited to 'include/afl-fuzz.h')
-rw-r--r--include/afl-fuzz.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h
index 45de197d..a3e87129 100644
--- a/include/afl-fuzz.h
+++ b/include/afl-fuzz.h
@@ -168,6 +168,9 @@ struct queue_entry {
 
   double perf_score;                    /* performance score                */
 
+  u8 *testcase_buf;                     /* The testcase buffer, if loaded.  */
+  u32 testcase_refs;                    /* count of users of testcase buf   */
+
   struct queue_entry *next;             /* Next element, if any             */
 
 };
@@ -686,6 +689,12 @@ typedef struct afl_state {
   /* queue entries ready for splicing count (len > 4) */
   u32 ready_for_splicing_count;
 
+  /* How many queue entries currently have cached testcases */
+  u32 q_testcase_cache_count;
+  /* Refs to each queue entry with cached testcase (for eviction, if cache_count
+   * is too large) */
+  struct queue_entry *q_testcase_cache[TESTCASE_CACHE_SIZE];
+
 } afl_state_t;
 
 struct custom_mutator {
@@ -1132,5 +1141,12 @@ static inline u64 next_p2(u64 val) {
 
 }
 
+/* Returns the testcase buf from the file behind this queue entry.
+  Increases the refcount. */
+u8 *queue_testcase_take(afl_state_t *afl, struct queue_entry *q);
+
+/* Tell afl that this testcase may be evicted from the cache */
+void queue_testcase_release(afl_state_t *afl, struct queue_entry *q);
+
 #endif