diff options
author | Taylor Blau <me@ttaylorr.com> | 2023-07-12 19:38:08 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-14 09:32:03 -0700 |
commit | 51c31a6408c1eae3ad6c2f78ec136c1b415cad72 (patch) | |
tree | fca1d8bca330e3322aa2ed18728222ae2c77f447 /commit-graph.c | |
parent | 50a71c2942167654f95d00b450a961cf387547ec (diff) | |
download | git-51c31a6408c1eae3ad6c2f78ec136c1b415cad72.tar.gz |
commit-graph.c: prevent overflow in `load_tree_for_commit()`
In a similar spirit as previous commits, ensure that we don't overflow
when computing an offset into the commit_data chunk when the (relative)
graph position exceeds 2^32-1/GRAPH_DATA_WIDTH.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r-- | commit-graph.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/commit-graph.c b/commit-graph.c index 5e32063d3d..08d773567f 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -980,7 +980,7 @@ static struct tree *load_tree_for_commit(struct repository *r, g = g->base_graph; commit_data = g->chunk_commit_data + - GRAPH_DATA_WIDTH * (graph_pos - g->num_commits_in_base); + st_mult(GRAPH_DATA_WIDTH, graph_pos - g->num_commits_in_base); oidread(&oid, commit_data); set_commit_tree(c, lookup_tree(r, &oid)); |