From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Sat, 16 Jan 2016 11:03:05 +0000 Subject: [PATCH 1/3] ui-log: handle parse_commit() errors In-Reply-To: References: Message-ID: If parse_commit() fails, none of the fields in the commit structure will have been populated so we will dereference NULL when accessing item->tree. There isn't much we can do about the error at this point, but if we return true then we'll try parsing the commit again from print_commit() and we can report an error to the user at that point. Coverity-id: 13801 Signed-off-by: John Keeping --- ui-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-log.c b/ui-log.c index 4573255..a4dc707 100644 --- a/ui-log.c +++ b/ui-log.c @@ -141,7 +141,9 @@ static int show_commit(struct commit *commit, struct rev_info *revs) /* When we get here we have precisely one parent. */ parent = parents->item; - parse_commit(parent); + /* If we can't parse the commit, let print_commit() report an error. */ + if (parse_commit(parent)) + return 1; files = 0; add_lines = 0; -- 2.7.0.226.gfe986fe