{"thread":{"id":"50429","subject":"[PATCH 0/2] Initialize repo object in fuzz-commit-graph","startedAt":"2019-02-07T20:05:58Z","lastAt":"2019-02-07T20:06:03Z","messageCount":3,"participants":["Josh Steadmon"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"368730","messageId":"cover.1549569479.git.steadmon@google.com","threadId":"50429","inReplyTo":null,"subject":"[PATCH 0/2] Initialize repo object in fuzz-commit-graph","fromName":"Josh Steadmon","fromEmail":"steadmon@google.com","sentAt":"2019-02-07T20:05:52Z","receivedAt":"2019-02-07T20:05:58Z","isPatch":true,"sender":{"key":"steadmon@google.com","avatar":"https://avatars.githubusercontent.com/u/2654920?v=4"},"body":"commit-graph.c now depends on the_hash_algo, which means the_repository\nmust be initialized before attempting to load a commit graph. This\nseries adds the initialization and cleanup to fuzz-commit-graph, and\nfixes a leak it discovered in the cleanup code.\n\nJosh Steadmon (2):\n  fuzz-commit-graph: initialize repo objects\n  object: fix leak of shallow_stat\n\n fuzz-commit-graph.c | 3 +++\n object.c            | 2 ++\n 2 files changed, 5 insertions(+)\n\n-- \n2.20.1.611.gfbb209baf1-goog\n\n"},{"id":"368731","messageId":"2dc66703537cfdbd6eb08ac4a7341c0f278621a1.1549569479.git.steadmon@google.com","threadId":"50429","inReplyTo":"cover.1549569479.git.steadmon@google.com","subject":"[PATCH 1/2] fuzz-commit-graph: initialize repo object","fromName":"Josh Steadmon","fromEmail":"steadmon@google.com","sentAt":"2019-02-07T20:05:53Z","receivedAt":"2019-02-07T20:06:00Z","isPatch":true,"sender":{"key":"steadmon@google.com","avatar":"https://avatars.githubusercontent.com/u/2654920?v=4"},"body":"Various #DEFINE \"constants\" in commit-graph.c now depend on\nthe_hash_algo->rawsz, but this object must be initialized before it can\nbe used.\n\nSigned-off-by: Josh Steadmon <steadmon@google.com>\n---\n fuzz-commit-graph.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/fuzz-commit-graph.c b/fuzz-commit-graph.c\nindex cf790c9d04..0157acbf2e 100644\n--- a/fuzz-commit-graph.c\n+++ b/fuzz-commit-graph.c\n@@ -1,4 +1,5 @@\n #include \"commit-graph.h\"\n+#include \"repository.h\"\n \n struct commit_graph *parse_commit_graph(void *graph_map, int fd,\n \t\t\t\t\tsize_t graph_size);\n@@ -9,7 +10,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)\n {\n \tstruct commit_graph *g;\n \n+\tinitialize_the_repository();\n \tg = parse_commit_graph((void *)data, -1, size);\n+\trepo_clear(the_repository);\n \tfree(g);\n \n \treturn 0;\n-- \n2.20.1.611.gfbb209baf1-goog\n\n"},{"id":"368732","messageId":"9a0495694dc2344ae5fdf2a95b301cfca3ed4a79.1549569479.git.steadmon@google.com","threadId":"50429","inReplyTo":"cover.1549569479.git.steadmon@google.com","subject":"[PATCH 2/2] object: fix leak of shallow_stat","fromName":"Josh Steadmon","fromEmail":"steadmon@google.com","sentAt":"2019-02-07T20:05:54Z","receivedAt":"2019-02-07T20:06:03Z","isPatch":true,"sender":{"key":"steadmon@google.com","avatar":"https://avatars.githubusercontent.com/u/2654920?v=4"},"body":"In eee4502baaf (\"shallow: migrate shallow information into the object\nparser\", 2018-05-17), we added a stat_validity pointer into the\nparsed_object_pool struct, but did not add code to free this in\nparsed_object_pool_clear(). This leak was found by fuzz-commit-graph.\n\nClear the struct and then free it in parsed_object_pool_clear() to\nprevent the leak.\n\nSigned-off-by: Josh Steadmon <steadmon@google.com>\n---\n object.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/object.c b/object.c\nindex 5dc5eec367..ca0b093c37 100644\n--- a/object.c\n+++ b/object.c\n@@ -557,9 +557,11 @@ void parsed_object_pool_clear(struct parsed_object_pool *o)\n \tclear_alloc_state(o->commit_state);\n \tclear_alloc_state(o->tag_state);\n \tclear_alloc_state(o->object_state);\n+\tstat_validity_clear(o->shallow_stat);\n \tFREE_AND_NULL(o->blob_state);\n \tFREE_AND_NULL(o->tree_state);\n \tFREE_AND_NULL(o->commit_state);\n \tFREE_AND_NULL(o->tag_state);\n \tFREE_AND_NULL(o->object_state);\n+\tFREE_AND_NULL(o->shallow_stat);\n }\n-- \n2.20.1.611.gfbb209baf1-goog\n\n"}]}