* [PATCH] fsck-cache segfaults on a tag referring to a missing object.
@ 2005-05-03 8:28 Junio C Hamano
0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2005-05-03 8:28 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
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));
----------------------------------------------------------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-05-03 8:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-03 8:28 [PATCH] fsck-cache segfaults on a tag referring to a missing object Junio C Hamano
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).