# [PATCH] git-rev-list: avoid crash on broken repository

2 messages from 2005-08-19 to 2005-08-19. Participants: Sergey Vlasov, Junio C Hamano.
Thread: https://gitlist.dev/t/1595

## Sergey Vlasov, 2005-08-19 18:28

Subject: [PATCH] git-rev-list: avoid crash on broken repository
Message-ID: <20050819182835.GA12057@procyon.home>
URL: https://gitlist.dev/e/20050819182835.GA12057%40procyon.home

```
When following tags, check for parse_object() success and error out
properly instead of segfaulting.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
---

 rev-list.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

f4ec41063d2f43b06b7c8e511108b4c9bf9e6ebe
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -418,6 +418,8 @@ static struct commit *get_commit_referen
 		if (tag_objects && !(object->flags & UNINTERESTING))
 			add_pending_object(object, tag->tag);
 		object = parse_object(tag->tagged->sha1);
+		if (!object)
+			die("bad object %s", sha1_to_hex(tag->tagged->sha1));
 	}
 
 	/*

```

## Junio C Hamano, 2005-08-19 21:30

Subject: Re: [PATCH] git-rev-list: avoid crash on broken repository
Message-ID: <7vfyt5vclv.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vfyt5vclv.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20050819182835.GA12057@procyon.home>

```
I humbly appreciate your patch, sir.  I am really sorry to be in
the position of having to tell you this, but earlier the Emperor
Penguin himself gave me this shiny blue baseball bat and told me
to show it to any deserving person.  Could you please come
closer and kindly extend your neck a little bit more, so I can
swing it well at your head...

  Subject: Re: [PATCH] Teach applymbox to keep the Subject: line.
  Date: Wed, 17 Aug 2005 13:42:57 -0700
  Message-ID: <7vfyt8thv2.fsf@assigned-by-dhcp.cox.net>

  Linus Torvalds <torvalds@osdl.org> writes:

  > ...
  > Ergo: if somebody sends you mime-encoded patches, hit them
  > with a baseball bat (politely) and teach them not to do
  > that...

  I agree with you in principle and that is why I always run
  applymbox with the -q flag.  Maybe I should start trying the
  baseball bat approach to see what happens.

;-)

Anyway, I have merged your fix and pushed it out.  Thanks for
the patch.

```
