From: Taylor Blau Date: Wed, 12 Jul 2023 23:38:08 +0000 (-0400) Subject: commit-graph.c: prevent overflow in `load_tree_for_commit()` X-Git-Tag: v2.42.0-rc0~39^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51c31a6408c1eae3ad6c2f78ec136c1b415cad72;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- 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));