@matheusbsbs / matheus-bagliano / commits / dec38c8165
Fork 0

check return value from parse_commit() in various functions

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin Koegler committed Feb 18, 2008 at 21:48 UTC dec38c81657f02624752a65c24d72613316713f5
3 files changed +5 -4
commit.c
+1 -2
@@ -387,8 +387,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
387
388 while (parents) {
389 struct commit *commit = parents->item;
390 - parse_commit(commit);
391 - if (!(commit->object.flags & mark)) {
390 + if (!parse_commit(commit) && !(commit->object.flags & mark)) {
391 commit->object.flags |= mark;
392 insert_by_date(commit, list);
393 }
shallow.c
+2 -1
@@ -70,7 +70,8 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
70 cur_depth = *(int *)commit->util;
71 }
72 }
73 - parse_commit(commit);
73 + if (parse_commit(commit))
74 + die("invalid commit");
75 commit->object.flags |= not_shallow_flag;
76 cur_depth++;
77 for (p = commit->parents, commit = NULL; p; p = p->next) {
upload-pack.c
+2 -1
@@ -533,7 +533,8 @@ static void receive_needs(void)
533 /* make sure the real parents are parsed */
534 unregister_shallow(object->sha1);
535 object->parsed = 0;
536 - parse_commit((struct commit *)object);
536 + if (parse_commit((struct commit *)object))
537 + die("invalid commit");
538 parents = ((struct commit *)object)->parents;
539 while (parents) {
540 add_object_array(&parents->item->object,