git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Martin Koegler <mkoegler@auto.tuwien.ac.at>
Subject: [PATCH 12/12] check return value from parse_commit
Date: Mon, 18 Feb 2008 21:48:03 +0100	[thread overview]
Message-ID: <12033676844141-git-send-email-mkoegler@auto.tuwien.ac.at> (raw)
In-Reply-To: <12033676841015-git-send-email-mkoegler@auto.tuwien.ac.at>

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
 commit.c      |    3 +--
 shallow.c     |    3 ++-
 upload-pack.c |    3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/commit.c b/commit.c
index 5d57450..22ce776 100644
--- a/commit.c
+++ b/commit.c
@@ -387,8 +387,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
 
 	while (parents) {
 		struct commit *commit = parents->item;
-		parse_commit(commit);
-		if (!(commit->object.flags & mark)) {
+		if (!parse_commit(commit) && !(commit->object.flags & mark)) {
 			commit->object.flags |= mark;
 			insert_by_date(commit, list);
 		}
diff --git a/shallow.c b/shallow.c
index 212e62b..4d90eda 100644
--- a/shallow.c
+++ b/shallow.c
@@ -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) {
diff --git a/upload-pack.c b/upload-pack.c
index 53676ee..20d5462 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -534,7 +534,8 @@ static void receive_needs(void)
 				/* make sure the real parents are parsed */
 				unregister_shallow(object->sha1);
 				object->parsed = 0;
-				parse_commit((struct commit *)object);
+				if (parse_commit((struct commit *)object))
+					die("invalid commit");
 				parents = ((struct commit *)object)->parents;
 				while (parents) {
 					add_object_array(&parents->item->object,
-- 
1.5.4.1.g96b77

  reply	other threads:[~2008-02-18 20:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18 20:47 [PATCH 01/12] read_object_with_reference: don't read beyond the buffer Martin Koegler
2008-02-18 20:47 ` [PATCH 02/12] get_sha1_oneline: check return value of parse_object Martin Koegler
2008-02-18 20:47   ` [PATCH 03/12] mark_blob/tree_uninteresting: check for NULL Martin Koegler
2008-02-18 20:47     ` [PATCH 04/12] add_one_tree: handle NULL from lookup_tree Martin Koegler
2008-02-18 20:47       ` [PATCH 05/12] process_tree/blob: check for NULL Martin Koegler
2008-02-18 20:47         ` [PATCH 06/12] check results of parse_commit in merge_bases Martin Koegler
2008-02-18 20:47           ` [PATCH 07/12] peel_onion: handle NULL Martin Koegler
2008-02-18 20:47             ` [PATCH 08/12] process_tag: handle tag->tagged == NULL Martin Koegler
2008-02-18 20:48               ` [PATCH 09/12] process_tree/blob: check for NULL Martin Koegler
2008-02-18 20:48                 ` [PATCH 10/12] revision.c: handle tag->tagged == NULL Martin Koegler
2008-02-18 20:48                   ` [PATCH 11/12] parse_commit: don't fail, if object is NULL Martin Koegler
2008-02-18 20:48                     ` Martin Koegler [this message]
2008-02-19 21:31         ` [PATCH 05/12] process_tree/blob: check for NULL Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12033676844141-git-send-email-mkoegler@auto.tuwien.ac.at \
    --to=mkoegler@auto.tuwien.ac.at \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).