<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/fuzz-commit-graph.c, branch v2.38.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.38.4</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.38.4'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2022-07-14T22:42:17Z</updated>
<entry>
<title>commit-graph: pass repo_settings instead of repository</title>
<updated>2022-07-14T22:42:17Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2022-07-14T21:43:06Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=a92d8523cef66d46e24cd5ef2f01ef97dc4ab239'/>
<id>urn:sha1:a92d8523cef66d46e24cd5ef2f01ef97dc4ab239</id>
<content type='text'>
The parse_commit_graph() function takes a 'struct repository *' pointer,
but it only ever accesses config settings (either directly or through
the .settings field of the repo struct). Move all relevant config
settings into the repo_settings struct, and update parse_commit_graph()
and its existing callers so that it takes 'struct repo_settings *'
instead.

Callers of parse_commit_graph() will now need to call
prepare_repo_settings() themselves, or initialize a 'struct
repo_settings' directly.

Prior to ab14d0676c (commit-graph: pass a 'struct repository *' in more
places, 2020-09-09), parsing a commit-graph was a pure function
depending only on the contents of the commit-graph itself. Commit
ab14d0676c introduced a dependency on a `struct repository` pointer, and
later commits such as b66d84756f (commit-graph: respect
'commitGraph.readChangedPaths', 2020-09-09) added dependencies on config
settings, which were accessed through the `settings` field of the
repository pointer. This field was initialized via a call to
`prepare_repo_settings()`.

Additionally, this fixes an issue in fuzz-commit-graph: In 44c7e62
(2021-12-06, repo-settings:prepare_repo_settings only in git repos),
prepare_repo_settings was changed to issue a BUG() if it is called by a
process whose CWD is not a Git repository.

The combination of commits mentioned above broke fuzz-commit-graph,
which attempts to parse arbitrary fuzzing-engine-provided bytes as a
commit graph file. Prior to this change, parse_commit_graph() called
prepare_repo_settings(), but since we run the fuzz tests without a valid
repository, we are hitting the BUG() from 44c7e62 for every test case.

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-graph: pass a 'struct repository *' in more places</title>
<updated>2020-09-09T19:51:48Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2020-09-09T15:22:56Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=ab14d0676c58389e6f0ccbb9569b07045a05b6df'/>
<id>urn:sha1:ab14d0676c58389e6f0ccbb9569b07045a05b6df</id>
<content type='text'>
In a future commit, some commit-graph internals will want access to
'r-&gt;settings', but we only have the 'struct object_directory *'
corresponding to that repository.

Add an additional parameter to pass the repository around in more
places.

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fuzz-commit-graph: properly free graph struct</title>
<updated>2020-06-08T17:02:29Z</updated>
<author>
<name>Josh Steadmon</name>
<email>steadmon@google.com</email>
</author>
<published>2020-06-05T22:55:14Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=104de88675a16729ec317b87df045919e611d218'/>
<id>urn:sha1:104de88675a16729ec317b87df045919e611d218</id>
<content type='text'>
Use the provided free_commit_graph() to properly free the commit graph
in fuzz-commit-graph. Otherwise, the fuzzer itself leaks memory when the
struct contains pointers to allocated memory.

Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-graph: close descriptors after mmap</title>
<updated>2020-04-25T05:25:50Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-04-23T21:41:13Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=c8828530b7797f5ab584c84dc2b86d3c14b39c8d'/>
<id>urn:sha1:c8828530b7797f5ab584c84dc2b86d3c14b39c8d</id>
<content type='text'>
We don't ever refer to the descriptor after mmap-ing it. And keeping it
open means we can run out of descriptors in degenerate cases (e.g.,
thousands of split chain files). Let's close it as soon as possible.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fuzz-commit-graph: initialize repo object</title>
<updated>2019-02-07T21:02:26Z</updated>
<author>
<name>Josh Steadmon</name>
<email>steadmon@google.com</email>
</author>
<published>2019-02-07T20:05:53Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=249dc534449f6fabd65894f20ee079fd394ab832'/>
<id>urn:sha1:249dc534449f6fabd65894f20ee079fd394ab832</id>
<content type='text'>
Various #DEFINE "constants" in commit-graph.c now depend on
the_hash_algo-&gt;rawsz, but this object must be initialized before it can
be used.

Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-graph, fuzz: add fuzzer for commit-graph</title>
<updated>2019-01-16T04:31:49Z</updated>
<author>
<name>Josh Steadmon</name>
<email>steadmon@google.com</email>
</author>
<published>2019-01-15T22:25:50Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=aa658574bfcbe03f5703458ac10be1ef3f5f5472'/>
<id>urn:sha1:aa658574bfcbe03f5703458ac10be1ef3f5f5472</id>
<content type='text'>
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 &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
