Add mode for LLVM libFuzzer
diff --git a/tests/fuzztest/fuzztest.c b/tests/fuzztest/fuzztest.c
index 93065ae..9f745ca 100644
--- a/tests/fuzztest/fuzztest.c
+++ b/tests/fuzztest/fuzztest.c
@@ -404,6 +404,23 @@
free_with_check(buf3);
}
+#ifdef LLVMFUZZER
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ bool status;
+
+ if (do_static_decode(data, size, false))
+ do_static_roundtrip(data, size);
+
+ if (do_pointer_decode(data, size, false))
+ do_pointer_roundtrip(data, size);
+
+ return 0;
+}
+
+#else
+
static void run_iteration()
{
uint8_t *buffer = malloc_with_check(BUFSIZE);
@@ -495,4 +512,4 @@
return 0;
}
-
+#endif