git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: [PATCH] fsck-cache segfaults on a tag referring to a missing object.
Date: Tue, 03 May 2005 01:28:11 -0700	[thread overview]
Message-ID: <7vzmvcww6c.fsf@assigned-by-dhcp.cox.net> (raw)

I do not understand the comment about ignoring tag reachability
in check_connectivity(), but fsck_tag() fails to notice that a
parsing of tag may have failed in the parse_object() call in
fsck_sha1() before it is called, in which case it can get a tag
object with NULL in the tagged field and segfault.  Here is a
patch to fix this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

P.S. Since this is probably more urgent than other fixes I've
been bugging you about, I am sending this via e-mail, not as a
GIT pull request, but I have a couple more update there, along
with updated HEAD.

--- a/fsck-cache.c
+++ b/fsck-cache.c
@@ -136,6 +136,12 @@ static int fsck_tag(struct tag *tag)
 	if (!show_tags)
 		return 0;
 
+	if (!tag->tagged) {
+		printf("bad referenced object in tag %s\n",
+		       sha1_to_hex(tag->object.sha1));
+		return 0;
+	}
+
 	printf("tagged %s %s",
 	       tag->tagged->type,
 	       sha1_to_hex(tag->tagged->sha1));


----------------------------------------------------------------


                 reply	other threads:[~2005-05-03  8:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7vzmvcww6c.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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).