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 <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Josh Steadmon
2018-10-12 17:58:40 -07:00
committed by Junio C Hamano
parent 2efbb7f521
commit 5e47215080
3 changed files with 48 additions and 0 deletions

14
fuzz-pack-headers.c Normal file
View File

@ -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;
}