/src/git/oss-fuzz/fuzz-commit-graph.c
Line | Count | Source |
1 | | #define USE_THE_REPOSITORY_VARIABLE |
2 | | |
3 | | #include "git-compat-util.h" |
4 | | #include "commit-graph.h" |
5 | | #include "repository.h" |
6 | | |
7 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); |
8 | | |
9 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
10 | 2.34k | { |
11 | 2.34k | struct commit_graph *g; |
12 | | |
13 | 2.34k | initialize_repository(the_repository); |
14 | | |
15 | | /* |
16 | | * Initialize the_repository with commit-graph settings that would |
17 | | * normally be read from the repository's gitdir. We want to avoid |
18 | | * touching the disk to keep the individual fuzz-test cases as fast as |
19 | | * possible. |
20 | | */ |
21 | 2.34k | repo_set_hash_algo(the_repository, GIT_HASH_SHA1); |
22 | 2.34k | the_repository->settings.initialized = 1; |
23 | 2.34k | the_repository->settings.commit_graph_generation_version = 2; |
24 | 2.34k | the_repository->settings.commit_graph_changed_paths_version = 1; |
25 | 2.34k | g = parse_commit_graph(the_repository, (void *)data, size); |
26 | 2.34k | repo_clear(the_repository); |
27 | 2.34k | free_commit_graph(g); |
28 | | |
29 | 2.34k | return 0; |
30 | 2.34k | } |