path: root/commit-graph.h
diff options
authorJosh Steadmon <>2019-01-15 22:25:50 (GMT)
committerJunio C Hamano <>2019-01-16 04:31:49 (GMT)
commitaa658574bfcbe03f5703458ac10be1ef3f5f5472 (patch)
treeb8841623f51f1013b9207a53b199f3f0b557b56b /commit-graph.h
parent77556354bb7ac50450e3b28999e3576969869068 (diff)
commit-graph, fuzz: add fuzzer for commit-graph
Break load_commit_graph_one() into a new function, parse_commit_graph(). The latter function operates on arbitrary buffers, which makes it suitable as a fuzzing target. Since parse_commit_graph() is only called by load_commit_graph_one() (and the fuzzer described below), we omit error messages that would be duplicated by the caller. Adds fuzz-commit-graph.c, which provides a fuzzing entry point compatible with libFuzzer (and possibly other fuzzing engines). Signed-off-by: Josh Steadmon <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'commit-graph.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/commit-graph.h b/commit-graph.h
index 9db40b4..813e7c1 100644
--- a/commit-graph.h
+++ b/commit-graph.h
@@ -54,6 +54,9 @@ struct commit_graph {
struct commit_graph *load_commit_graph_one(const char *graph_file);
+struct commit_graph *parse_commit_graph(void *graph_map, int fd,
+ size_t graph_size);
* Return 1 if and only if the repository has a commit-graph
* file and generation numbers are computed in that file.