Skip to content

Commit

Permalink
fsck-cache: fix SIGSEGV on bad tag object
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds committed May 3, 2005
1 parent 54c26fb commit 92d4c85
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions fsck-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 92d4c85

Please sign in to comment.