git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsck: do not crash on tag objects which do not contain an empty line
@ 2007-06-07 22:40 Johannes Schindelin
  2007-06-07 23:08 ` Johan Herland
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Johannes Schindelin @ 2007-06-07 22:40 UTC (permalink / raw)
  To: git, gitster


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-06-08  8:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 22:40 [PATCH] fsck: do not crash on tag objects which do not contain an empty line Johannes Schindelin
2007-06-07 23:08 ` Johan Herland
2007-06-07 23:13   ` Johannes Schindelin
2007-06-07 23:28     ` Johan Herland
2007-06-07 23:38       ` Johannes Schindelin
2007-06-08  2:04       ` Nicolas Pitre
2007-06-08  2:14         ` Johan Herland
2007-06-08  5:17 ` Junio C Hamano
2007-06-08  5:30   ` Johannes Schindelin
2007-06-08  8:32 ` Andy Parkins

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