Skip to contentSkip to conversation

git-rev-list: avoid crash on broken repository

PATCH In review Sergey Vlasov 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-rev-list: avoid crash on broken repository

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

---

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

f4ec41063d2f43b06b7c8e511108b4c9bf9e6ebe

rev-list.c +2 -0
@@ -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));
 	}
 
 	/*
#1 lore raw

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: <[email protected]>

Quoted 4 lines · Linus Torvalds

...
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.