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

committed by
Junio C Hamano

parent
50a71c2942
commit
51c31a6408
@ -980,7 +980,7 @@ static struct tree *load_tree_for_commit(struct repository *r,
|
|||||||
g = g->base_graph;
|
g = g->base_graph;
|
||||||
|
|
||||||
commit_data = g->chunk_commit_data +
|
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);
|
oidread(&oid, commit_data);
|
||||||
set_commit_tree(c, lookup_tree(r, &oid));
|
set_commit_tree(c, lookup_tree(r, &oid));
|
||||||
|
Reference in New Issue
Block a user