From: Taylor Blau Date: Wed, 12 Jul 2023 23:38:16 +0000 (-0400) Subject: commit-graph.c: prevent overflow in `write_commit_graph()` X-Git-Tag: v2.42.0-rc0~39^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=588af1bfd3c810e02df1d8adc37e9c43a7f97920;p=thirdparty%2Fgit.git commit-graph.c: prevent overflow in `write_commit_graph()` In a similar spirit as previous commits, ensure that we don't overflow when trying to read an existing OID while writing a new commit-graph. Signed-off-by: Taylor Blau Signed-off-by: Junio C Hamano --- diff --git a/commit-graph.c b/commit-graph.c index 8333ce8e04..54697e7a4d 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -2454,7 +2454,7 @@ int write_commit_graph(struct object_directory *odb, struct commit_graph *g = ctx->r->objects->commit_graph; for (i = 0; i < g->num_commits; i++) { struct object_id oid; - oidread(&oid, g->chunk_oid_lookup + g->hash_len * i); + oidread(&oid, g->chunk_oid_lookup + st_mult(g->hash_len, i)); oid_array_append(&ctx->oids, &oid); } }