X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=shallow.c;h=4d90eda19efe0a80c1cb39e8897ab3ed5e6fcf56;hb=712d352577012d5035da69bbf49ea0f0df8bb7da;hp=dbd9f5ad0ac21e70fc3a095d8e2938f245c238d3;hpb=f1a8cc635455a65567d040349327b9ea4adb479b;p=git.git diff --git a/shallow.c b/shallow.c index dbd9f5ad0..4d90eda19 100644 --- a/shallow.c +++ b/shallow.c @@ -56,7 +56,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, if (i < heads->nr) { commit = (struct commit *) deref_tag(heads->objects[i++].item, NULL, 0); - if (commit->object.type != OBJ_COMMIT) { + if (!commit || commit->object.type != OBJ_COMMIT) { commit = NULL; continue; } @@ -70,7 +70,8 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, cur_depth = *(int *)commit->util; } } - parse_commit(commit); + if (parse_commit(commit)) + die("invalid commit"); commit->object.flags |= not_shallow_flag; cur_depth++; for (p = commit->parents, commit = NULL; p; p = p->next) {