]> git.ipfire.org Git - thirdparty/git.git/commit
commit-graph.c: prevent overflow in `write_commit_graph_file()`
authorTaylor Blau <me@ttaylorr.com>
Wed, 12 Jul 2023 23:37:54 +0000 (19:37 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Jul 2023 16:32:03 +0000 (09:32 -0700)
commit48f3f8cf37043f69e9834d38e2439abfde280964
tree167838557111e52835fea13fadbc233d4f85a434
parent0948c501761585bdf3e4e1133700c2eb867d88e6
commit-graph.c: prevent overflow in `write_commit_graph_file()`

When writing a commit-graph, we use the chunk-format API to write out
each individual chunk of the commit-graph. Each chunk of the
commit-graph is tracked via a call to `add_chunk()`, along with the
expected size of that chunk.

Similar to an earlier commit which handled the identical issue in the
MIDX machinery, guard against overflow when dealing with a commit-graph
with a large number of entries to avoid corrupting the contents of the
commit-graph itself.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-graph.c