]>
git.proxmox.com Git - libgit2.git/blob - fuzzers/patch_parse_fuzzer.c
2 * libgit2 patch parser 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.
12 #include "patch_parse.h"
14 #define UNUSED(x) (void)(x)
16 int LLVMFuzzerInitialize(int *argc
, char ***argv
)
21 if (git_libgit2_init() < 0)
27 int LLVMFuzzerTestOneInput(const uint8_t *data
, size_t size
)
30 git_patch
*patch
= NULL
;
31 git_patch_options opts
= GIT_PATCH_OPTIONS_INIT
;
32 opts
.prefix_len
= (uint32_t)data
[0];
33 git_patch_from_buffer(&patch
, (const char *)data
+ 1, size
- 1,
35 git_patch_free(patch
);