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 <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Jul 12, 2023 at 19:38 UTC 588af1bfd3c810e02df1d8adc37e9c43a7f97920
1 file changed +1 -1
commit-graph.c
+1 -1
@@ -2454,7 +2454,7 @@ int write_commit_graph(struct object_directory *odb,
2454 struct commit_graph *g = ctx->r->objects->commit_graph;
2455 for (i = 0; i < g->num_commits; i++) {
2456 struct object_id oid;
2457 - oidread(&oid, g->chunk_oid_lookup + g->hash_len * i);
2457 + oidread(&oid, g->chunk_oid_lookup + st_mult(g->hash_len, i));
2458 oid_array_append(&ctx->oids, &oid);
2459 }
2460 }