diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-03 07:57:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-03 07:57:56 -0700 |
commit | 92d4c85d248728b1937d01fdd088173753c6994d (patch) | |
tree | 339a936a044f5aa3d575388df62725abab35b750 /fsck-cache.c | |
parent | 54c26fb9d0cdff94c7717125d0a222b324bfea8a (diff) | |
download | git-92d4c85d248728b1937d01fdd088173753c6994d.tar.gz git-92d4c85d248728b1937d01fdd088173753c6994d.tar.xz |
fsck-cache: fix SIGSEGV on bad tag object
fsck_tag() failes to notice that the parsing of the tag may
have failed in the parse_object() call on the object that it
is tagging.
Noticed by Junio.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fsck-cache.c')
-rw-r--r-- | fsck-cache.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fsck-cache.c b/fsck-cache.c index 637aededb..fb0d82f33 100644 --- a/fsck-cache.c +++ b/fsck-cache.c @@ -133,14 +133,17 @@ static int fsck_commit(struct commit *commit) static int fsck_tag(struct tag *tag) { + struct object *tagged = tag->tagged; + + if (!tagged) { + printf("bad object in tag %s\n", sha1_to_hex(tag->object.sha1)); + return -1; + } if (!show_tags) return 0; - printf("tagged %s %s", - tag->tagged->type, - sha1_to_hex(tag->tagged->sha1)); - printf(" (%s) in %s\n", - tag->tag, sha1_to_hex(tag->object.sha1)); + printf("tagged %s %s", tagged->type, sha1_to_hex(tagged->sha1)); + printf(" (%s) in %s\n", tag->tag, sha1_to_hex(tag->object.sha1)); return 0; } |