]>
git.proxmox.com Git - libgit2.git/blob - fuzzers/objects_fuzzer.c
2 * libgit2 packfile fuzzer target.
4 * Copyright (C) the libgit2 contributors. All rights reserved.
6 * This file is part of libgit2, distributed under the GNU GPL v2 with
7 * a Linking Exception. For full terms see the included COPYING file.
13 #include "standalone_driver.h"
15 #define UNUSED(x) (void)(x)
17 int LLVMFuzzerInitialize(int *argc
, char ***argv
)
22 if (git_libgit2_init() < 0)
28 int LLVMFuzzerTestOneInput(const uint8_t *data
, size_t size
)
30 const git_object_t types
[] = {
31 GIT_OBJECT_BLOB
, GIT_OBJECT_TREE
, GIT_OBJECT_COMMIT
, GIT_OBJECT_TAG
33 git_object
*object
= NULL
;
37 * Brute-force parse this as every object type. We want
38 * to stress the parsing logic anyway, so this is fine
41 for (i
= 0; i
< ARRAY_SIZE(types
); i
++) {
42 if (git_object__from_raw(&object
, (const char *) data
, size
, types
[i
]) < 0)
44 git_object_free(object
);