From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH] fsck: do not crash on tag objects which do not contain an empty line
Date: Thu, 7 Jun 2007 23:40:12 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0706072338260.4046@racer.site> (raw)
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 reply other threads:[~2007-06-07 22:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-07 22:40 Johannes Schindelin [this message]
2007-06-07 23:08 ` [PATCH] fsck: do not crash on tag objects which do not contain an empty line 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
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=Pine.LNX.4.64.0706072338260.4046@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).