From 5e47215080018b7eea2054ec70f5d686715d66ee Mon Sep 17 00:00:00 2001 From: Josh Steadmon Date: Fri, 12 Oct 2018 17:58:40 -0700 Subject: fuzz: add basic fuzz testing target. fuzz-pack-headers.c provides a fuzzing entry point compatible with libFuzzer (and possibly other fuzzing engines). Signed-off-by: Josh Steadmon Signed-off-by: Junio C Hamano --- fuzz-pack-headers.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 fuzz-pack-headers.c (limited to 'fuzz-pack-headers.c') diff --git a/fuzz-pack-headers.c b/fuzz-pack-headers.c new file mode 100644 index 0000000000..99da1d0fd3 --- /dev/null +++ b/fuzz-pack-headers.c @@ -0,0 +1,14 @@ +#include "packfile.h" + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + enum object_type type; + unsigned long len; + + unpack_object_header_buffer((const unsigned char *)data, + (unsigned long)size, &type, &len); + + return 0; +} -- cgit v1.2.3