Re: [PATCH 1/2] commit-graph, fuzz: Add fuzzer for commit-graph
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 6, 2018, 01:41 UTC
- Message-ID
- <xmqqin07a0ul.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <xmqqmupja19b.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
>> + if (graph_size < GRAPH_MIN_SIZE) >> + return NULL; >> + > > The load_commit_graph_one() grabbed graph_map out of xmmap() so it > is guaranteed to be non-NULL, but we need to check graph_map != NULL > when we're calling this directly from the fuzz tests, exactly in the > same spirit that we check graph_size above. Besides, these are to > make sure future callers won't misuse the API.
Insert "Please check graph_map != NULL here, too." before the above paragraph.
Show 7 quoted lines
>> data = (const unsigned char *)graph_map; > > And the reset of the function is the same as the original modulo > jumping to the cleanup_fail label has been replaced with returning > NULL. > > Looks good.
Of course, s/reset/rest/ is what I meant.