about summary refs log tree commit diff
path: root/test/test-custom-mutator.c
diff options
context:
space:
mode:
authorh1994st <h1994st@gmail.com>2020-03-27 02:03:20 -0400
committerDominik Maier <domenukk@gmail.com>2020-03-30 16:46:11 +0200
commitff14dfc0fc099cf68a9a9b4168b601be45d03e1c (patch)
treed5b2dbfb795bf4e0f424c777fdade42d553ee40b /test/test-custom-mutator.c
parentc6248317174ef8fd61360148c8ef95ed7c806a7e (diff)
downloadafl++-ff14dfc0fc099cf68a9a9b4168b601be45d03e1c.tar.gz
Add a test case for the custom mutator
- Update the Makefile in examples/custom_mutators
- Add a test program for testing the custom mutator
- Update test.sh for testing the custom mutator
- [TODO] Update the result checking criterias of the custom mutator in
test.sh
Diffstat (limited to 'test/test-custom-mutator.c')
-rw-r--r--test/test-custom-mutator.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test-custom-mutator.c b/test/test-custom-mutator.c
new file mode 100644
index 00000000..b44c3634
--- /dev/null
+++ b/test/test-custom-mutator.c
@@ -0,0 +1,20 @@
+/**
+ * Reference: https://github.com/bruce30262/libprotobuf-mutator_fuzzing_learning/blob/master/4_libprotobuf_aflpp_custom_mutator/vuln.c
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+    char str[100]={ };
+    read(0, str, 100);
+    int *ptr = NULL;
+    if( str[0] == 'P') {
+        *ptr = 123;
+    }
+    return 0;
+}