git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] line-log: fix crash when --first-parent is used
@ 2014-10-31 19:43 Tzvetan Mikov
  2014-11-03 20:58 ` Junio C Hamano
  2014-11-04 20:33 ` [PATCH v2] " Tzvetan Mikov
  0 siblings, 2 replies; 7+ messages in thread
From: Tzvetan Mikov @ 2014-10-31 19:43 UTC (permalink / raw)
  To: git; +Cc: Thomas Rast, Eric Sunshine, Tzvetan Mikov

line-log tries to access all parents of a commit, but only the first
parent has been loaded if "--first-parent" is specified, resulting
in a crash.

Limit the number of parents to one if "--first-parent" is specified.

Reported-by: Eric N. Vander Weele <ericvw@gmail.com>
Signed-off-by: Tzvetan Mikov <tmikov@gmail.com>
---
 line-log.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/line-log.c b/line-log.c
index 1008e72..86e7274 100644
--- a/line-log.c
+++ b/line-log.c
@@ -1141,6 +1141,9 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
 	int i;
 	int nparents = commit_list_count(commit->parents);
 
+	if (nparents > 1 && rev->first_parent_only)
+	    nparents = 1;
+
 	diffqueues = xmalloc(nparents * sizeof(*diffqueues));
 	cand = xmalloc(nparents * sizeof(*cand));
 	parents = xmalloc(nparents * sizeof(*parents));
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-04 21:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-31 19:43 [PATCH] line-log: fix crash when --first-parent is used Tzvetan Mikov
2014-11-03 20:58 ` Junio C Hamano
2014-11-03 22:09   ` Tzvetan Mikov
2014-11-04  9:34     ` Michael J Gruber
2014-11-04 20:33 ` [PATCH v2] " Tzvetan Mikov
2014-11-04 21:24   ` Junio C Hamano
2014-11-04 21:41     ` Tzvetan Mikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).