Add fuzz targets
Fuzzing is something that's good to do for a general purpose library and
can find bugs relatively quickly.
Enable fuzzing with libfuzzer (selected only because it was the easiest
to set up) and enable fuzz targets for 3 of our buffer-based interfaces.
Change-Id: I695a3a60ba09bea92cd462566bf2c46337eabd4b
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/tests/fuzz_cper_buf_to_ir.cpp b/tests/fuzz_cper_buf_to_ir.cpp
new file mode 100644
index 0000000..586c2ba
--- /dev/null
+++ b/tests/fuzz_cper_buf_to_ir.cpp
@@ -0,0 +1,11 @@
+#include "libcper/cper-parse.h"
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ json_object *ir = cper_buf_to_ir(data, size);
+ if (ir != NULL) {
+ json_object_put(ir);
+ }
+
+ return 0;
+}