about summary refs log tree commit diff
path: root/examples/persistent_demo
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-08-01 17:39:27 +0200
committervan Hauser <vh@thc.org>2020-08-01 17:39:27 +0200
commit4512377fa162be7bb8360628e11655670a61491b (patch)
treecbe82b9fd1260f58ec5972379ef33197fa74cb74 /examples/persistent_demo
parent9439ba1dac174741c7838c17de202b0dc68c6a88 (diff)
downloadafl++-4512377fa162be7bb8360628e11655670a61491b.tar.gz
compile persistent mode without afl
Diffstat (limited to 'examples/persistent_demo')
-rw-r--r--examples/persistent_demo/persistent_demo_new.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/persistent_demo/persistent_demo_new.c b/examples/persistent_demo/persistent_demo_new.c
index e4e328b0..86b19fa8 100644
--- a/examples/persistent_demo/persistent_demo_new.c
+++ b/examples/persistent_demo/persistent_demo_new.c
@@ -28,6 +28,17 @@
 #include <signal.h>
 #include <string.h>
 
+/* this lets the source compile without afl-clang-fast/lto */
+#ifndef __AFL_FUZZ_TESTCASE_LEN
+  ssize_t fuzz_len;
+  #define __AFL_FUZZ_TESTCASE_LEN fuzz_len
+  unsigned char fuzz_buf[1024000];
+  #define __AFL_FUZZ_TESTCASE_BUF fuzz_buf
+  #define __AFL_FUZZ_INIT() void sync(void);
+  #define __AFL_LOOP(x) ((fuzz_len = read(0, fuzz_buf, sizeof(fuzz_buf))) > 0 ?
+  #define __AFL_INIT() sync() 
+#endif
+
 __AFL_FUZZ_INIT();
 
 /* Main entry point. */