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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tzvetan Mikov <tmikov@xxxxxxxxx> writes:

> 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@xxxxxxxxx>
> Signed-off-by: Tzvetan Mikov <tmikov@xxxxxxxxx>
> ---

Thomas, how does this one look?

Tzvetan, can we have a test for this one?

Thanks.

>  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));
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]