{"thread":{"id":"6589","subject":"[PATCH] Don't coredump on bad refs in update-server-info.","startedAt":"2007-01-31T07:24:44Z","lastAt":"2007-01-31T08:20:47Z","messageCount":2,"participants":["Shawn O. Pearce","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"33113","messageId":"20070131072444.GA28804@spearce.org","threadId":"6589","inReplyTo":null,"subject":"[PATCH] Don't coredump on bad refs in update-server-info.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-01-31T07:24:44Z","receivedAt":"2007-01-31T07:24:44Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Apparently if we are unable to parse an object update-server-info\ncoredumps, as it doesn't bother to check the return value of its\ncall to parse_object.\n\nInstead of coredumping, skip the ref.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n\n I don't know how often folks might run into this.  I intentionally\n broke pack reading in one of my topics and discovered that\n update-server-info crashed with a segfault when the pack access code\n was unable to decompress the object behind the ref.  That's less\n than optimal.\n\n server-info.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/server-info.c b/server-info.c\nindex 6cd38be..f9be5a7 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -10,6 +10,8 @@ static FILE *info_ref_fp;\n static int add_info_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)\n {\n \tstruct object *o = parse_object(sha1);\n+\tif (!o)\n+\t\treturn -1;\n \n \tfprintf(info_ref_fp, \"%s\t%s\\n\", sha1_to_hex(sha1), path);\n \tif (o->type == OBJ_TAG) {\n-- \n1.5.0.rc2.81.g73a2\n"},{"id":"33114","messageId":"eppjeg$tgk$1@sea.gmane.org","threadId":"6589","inReplyTo":"20070131072444.GA28804@spearce.org","subject":"Re: [PATCH] Don't coredump on bad refs in update-server-info.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-31T08:20:47Z","receivedAt":"2007-01-31T08:20:47Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Shawn O. Pearce wrote:\n\n> Apparently if we are unable to parse an object update-server-info\n> coredumps, as it doesn't bother to check the return value of its\n\n\"Apparently if we are unable to parse an object _then_ update-server-info\n coredumps\" is a bit more easier to understand.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}