summaryrefslogtreecommitdiff
path: root/src/commit_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/commit_list.c')
-rw-r--r--src/commit_list.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/commit_list.c b/src/commit_list.c
index 209655434..a58a0a7e0 100644
--- a/src/commit_list.c
+++ b/src/commit_list.c
@@ -114,8 +114,14 @@ static int commit_quick_parse(
return error;
}
+ if (!git__is_uint16(git_array_size(commit->parent_ids))) {
+ git__free(commit);
+ git_error_set(GIT_ERROR_INVALID, "commit has more than 2^16 parents");
+ return -1;
+ }
+
node->time = commit->committer->when.time;
- node->out_degree = git_array_size(commit->parent_ids);
+ node->out_degree = (uint16_t) git_array_size(commit->parent_ids);
node->parents = alloc_parents(walk, node, node->out_degree);
GIT_ERROR_CHECK_ALLOC(node->parents);