diff options
author | Josh Steadmon <steadmon@google.com> | 2018-10-12 17:58:41 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-15 14:29:03 +0900 |
commit | 1127a98ccea2a911d2043dcc9ce301e080a3cc39 (patch) | |
tree | e22ba4d30cc39102180641508bdff90b9fef76dd /fuzz-pack-idx.c | |
parent | 5e47215080018b7eea2054ec70f5d686715d66ee (diff) | |
download | git-1127a98ccea2a911d2043dcc9ce301e080a3cc39.tar.gz |
fuzz: add fuzz testing for packfile indices.
Breaks the majority of check_packed_git_idx() into a separate function,
load_idx(). The latter function operates on arbitrary buffers, which
makes it suitable as a fuzzing test target.
Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fuzz-pack-idx.c')
-rw-r--r-- | fuzz-pack-idx.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fuzz-pack-idx.c b/fuzz-pack-idx.c new file mode 100644 index 0000000000..0c3d777aac --- /dev/null +++ b/fuzz-pack-idx.c @@ -0,0 +1,13 @@ +#include "object-store.h" +#include "packfile.h" + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + struct packed_git p; + + load_idx("fuzz-input", GIT_SHA1_RAWSZ, (void *)data, size, &p); + + return 0; +} |