From: Erik Faye-Lund <kusmabite@gmail.com>
To: git@vger.kernel.org
Cc: Erik Faye-Lund <kusmabite@gmail.com>
Subject: [PATCH] builtin-fast-export.c: add default case to avoid crash on corrupt repo
Date: Sat, 21 Mar 2009 22:37:31 +0000 [thread overview]
Message-ID: <1237675051-6688-1-git-send-email-kusmabite@gmail.com> (raw)
This small issue was discovered by Benjamin Kramers Clang-runs on the git
code-base. If a tag object points to an object that is not a commit or a blob,
an invalid pointer is dereferenced in the code that followed.
This patch fixes this issue, by giving an error instead. This should also be
more useful when debugging corrupted repos.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
builtin-fast-export.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index fdf4ae9..26b2a93 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -375,6 +375,9 @@ static void get_tags_and_duplicates(struct object_array *pending,
case OBJ_BLOB:
handle_object(tag->object.sha1);
continue;
+ default:
+ die ("Unexpected object of type %s",
+ typename(tag->object.type));
}
break;
default:
--
1.6.2.1.215.gf786.dirty
next reply other threads:[~2009-03-21 23:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-21 22:37 Erik Faye-Lund [this message]
2009-03-21 23:54 ` [PATCH] builtin-fast-export.c: add default case to avoid crash on corrupt repo Junio C Hamano
2009-03-22 12:22 ` Erik Faye-Lund
2009-03-22 12:32 ` Erik Faye-Lund
2009-03-22 21:58 ` Junio C Hamano
2009-03-23 0:26 ` Shawn O. Pearce
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=1237675051-6688-1-git-send-email-kusmabite@gmail.com \
--to=kusmabite@gmail.com \
--cc=git@vger.kernel.org \
/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).