From a8787c5c1c51f4bdb610526175442a23eea7c467 Mon Sep 17 00:00:00 2001 From: Tzvetan Mikov Date: Tue, 4 Nov 2014 12:33:37 -0800 Subject: line-log: fix crash when --first-parent is used 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 Signed-off-by: Tzvetan Mikov Signed-off-by: Junio C Hamano --- line-log.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'line-log.c') diff --git a/line-log.c b/line-log.c index c2d01dccc..fe04c9d10 100644 --- a/line-log.c +++ b/line-log.c @@ -1164,6 +1164,9 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm int i; int nparents = count_parents(commit); + if (nparents > 1 && rev->first_parent_only) + nparents = 1; + diffqueues = xmalloc(nparents * sizeof(*diffqueues)); cand = xmalloc(nparents * sizeof(*cand)); parents = xmalloc(nparents * sizeof(*parents)); -- cgit v1.2.1