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

[PATCH] fsck: do not crash on tag objects which do not contain an empty line

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 7, 2007, 22:40 UTC
Message-ID
<Pine.LNX.4.64.0706072338260.4046@racer.site>

The first empty line in a tag object separates the header from the message. If the tag object has no empty line, do not crash, but complain loudly instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	I have no idea how this tag crept into one of my repos, but it is 
	no good to crash for git-fsck.
 builtin-fsck.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 7a92e47..607136a 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -545,9 +545,14 @@ static void fsck_verify_ref_to_tag_object(const char *refname, struct object *ob
 {
 	/* Verify that refname matches the name stored in obj's "tag" header */
 	struct tag *tagobj = (struct tag *) parse_object(obj->sha1);
-	size_t tagname_len = strlen(tagobj->tag);
+	size_t tagname_len;
 	size_t refname_len = strlen(refname);
 
+	if (!tagobj->tag) {
+		error("tag %s does not contain any tag?", refname);
+		return;
+	}
+	tagname_len = strlen(tagobj->tag);
 	if (!tagname_len) return; /* No tag name stored in tagobj. Nothing to do. */
 
 	if (tagname_len < refname_len &&
-- 
1.5.2.1.2683.gab86-dirty
Next: Johan Herland
Message 1 of 10 in “fsck: do not crash on tag objects which do not contain an empty line”
  1. fsck: do not crash on tag objects which do not contain an empty lineJohannes Schindelin, Jun 7, 2007
  2. Johan HerlandJun 7, 2007
  3. Johannes SchindelinJun 7, 2007
  4. Johan HerlandJun 7, 2007
  5. Johannes SchindelinJun 7, 2007
  6. Nicolas PitreJun 8, 2007
  7. Johan HerlandJun 8, 2007
  8. Junio C HamanoJun 8, 2007
  9. Johannes SchindelinJun 8, 2007
  10. Andy ParkinsJun 8, 2007

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.