Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Steadmon <steadmon@google.com>2018-10-13 03:58:41 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-15 08:29:03 +0300
commit1127a98ccea2a911d2043dcc9ce301e080a3cc39 (patch)
treee22ba4d30cc39102180641508bdff90b9fef76dd /fuzz-pack-idx.c
parent5e47215080018b7eea2054ec70f5d686715d66ee (diff)
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.c13
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;
+}