git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] line-log: fix crash when --first-parent is used

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 3, 2014, 20:58 UTC
Message-ID
<xmqqoasoq9vh.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1414784636-43155-1-git-send-email-tmikov@gmail.com>
Tzvetan Mikov <tmikov@gmail.com> writes:
Show 9 quoted lines
> 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>
> ---
Thomas, how does this one look?
Tzvetan, can we have a test for this one?
Thanks.
Show 17 quoted lines
>  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));
Previous: Tzvetan MikovNext: Tzvetan Mikov
Message 2 of 7 in “line-log: fix crash when --first-parent is used”
  1. line-log: fix crash when --first-parent is usedTzvetan Mikov, Oct 31, 2014
  2. Junio C HamanoNov 3, 2014
  3. Tzvetan MikovNov 3, 2014
  4. Michael J GruberNov 4, 2014
  5. line-log: fix crash when --first-parent is usedTzvetan Mikov, Nov 4, 2014
  6. Junio C HamanoNov 4, 2014
  7. Tzvetan MikovNov 4, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.