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>
This commit is contained in:
committed by
Junio C Hamano
parent
209250ef38
commit
0bd8f30a0e
@ -754,7 +754,7 @@ static void load_oid_from_graph(struct commit_graph *g,
|
|||||||
|
|
||||||
lex_index = pos - g->num_commits_in_base;
|
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,
|
static struct commit_list **insert_parent_or_die(struct repository *r,
|
||||||
|
|||||||
Reference in New Issue
Block a user