aboutsummaryrefslogtreecommitdiffstats
path: root/commit-graph.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2023-07-12 19:38:00 -0400
committerJunio C Hamano <gitster@pobox.com>2023-07-14 09:32:03 -0700
commit0bd8f30a0e4e474163eb2d8dc3020d51ec3c8a35 (patch)
tree5b414b493a1945ecf99cd5602a28763668078a3b /commit-graph.c
parent209250ef38f353f174ee9e90e55f5a4605449f70 (diff)
downloadgit-0bd8f30a0e4e474163eb2d8dc3020d51ec3c8a35.tar.gz
commit-graph.c: prevent overflow in `load_oid_from_graph()`
In a similar spirit as previous commits, ensure that we don't overflow when trying to compute an offset into the `chunk_oid_lookup` table when the `lex_index` of the item we're trying to look up exceeds `2^32-1/g->hash_len`. 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/commit-graph.c b/commit-graph.c
index 17ab3e8029..517c816a94 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -754,7 +754,7 @@ static void load_oid_from_graph(struct commit_graph *g,
lex_index = pos - g->num_commits_in_base;
- oidread(oid, g->chunk_oid_lookup + g->hash_len * lex_index);
+ oidread(oid, g->chunk_oid_lookup + st_mult(g->hash_len, lex_index));
}
static struct commit_list **insert_parent_or_die(struct repository *r,