changeset 1354:7618759e9327 fuzz

better harness
author Matt Johnston <matt@ucc.asn.au>
date Thu, 18 May 2017 23:38:30 +0800
parents f3c8975de38e
children 3fdd8c5a0195
files fuzz-harness.c
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/fuzz-harness.c	Thu May 18 23:36:54 2017 +0800
+++ b/fuzz-harness.c	Thu May 18 23:38:30 2017 +0800
@@ -1,8 +1,25 @@
 #include "includes.h"
+#include "buffer.h"
+#include "dbutil.h"
 
 extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
 
 int main(int argc, char ** argv) {
-    LLVMFuzzerTestOneInput("hello", 5);
+    int i;
+    buffer *input = buf_new(100000);
+
+    for (i = 1; i < argc; i++) {
+        char* fn = argv[i];
+        buf_setlen(input, 0);
+        buf_readfile(input, fn);
+        buf_setpos(input, 0);
+
+        printf("Running %s\n", fn);
+        LLVMFuzzerTestOneInput(input->data, input->len);
+        printf("Done %s\n", fn);
+    }
+
+    printf("Finished\n");
+
     return 0;
 }