threads / patch / 1595

patchgit-rev-list: avoid crash on broken repository

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

## tl;dr

2 messages between Aug 19, 2005 and Aug 19, 2005. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Sergey Vlasov· Aug 19, 2005, 18:28 UTC · lore

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
Show changes to rev-list.c +2 −0
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· Aug 19, 2005, 21:30 UTC · re: Sergey Vlasov · lore

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

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.

← back to recent threads