aa658574bf
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 <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
17 lines
343 B
C
17 lines
343 B
C
#include "commit-graph.h"
|
|
|
|
struct commit_graph *parse_commit_graph(void *graph_map, int fd,
|
|
size_t graph_size);
|
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|
{
|
|
struct commit_graph *g;
|
|
|
|
g = parse_commit_graph((void *)data, -1, size);
|
|
free(g);
|
|
|
|
return 0;
|
|
}
|