git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] fsck-cache segfaults on a tag referring to a missing object.

From
Junio C Hamano <junkio@cox.net>
Date
May 3, 2005, 08:28 UTC
Message-ID
<7vzmvcww6c.fsf@assigned-by-dhcp.cox.net>

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));


----------------------------------------------------------------
Message 1 of 1 in “fsck-cache segfaults on a tag referring to a missing object.”
  1. fsck-cache segfaults on a tag referring to a missing object.Junio C Hamano, May 3, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.