Re: [PATCH v2] range-diff: don't segfault with mode-only changes
- From
Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
- Date
- Oct 9, 2019, 07:42 UTC
- Message-ID
- <20191009074200.crpjyajbaecaeza6@pengutronix.de>
- In-Reply-To
- <20191008173843.GC74671@cat>
On Tue, Oct 08, 2019 at 06:38:43PM +0100, Thomas Gummerer wrote:
Show 18 quoted lines
> In ef283b3699 ("apply: make parse_git_diff_header public", 2019-07-11)
> the 'parse_git_diff_header' function was made public and useable by
> callers outside of apply.c.
>
> However it was missed that its (then) only caller, 'find_header' did
> some error handling, and completing 'struct patch' appropriately.
>
> range-diff then started using this function, and tried to handle this
> appropriately itself, but fell short in some cases. This in turn
> would lead to range-diff segfaulting when there are mode-only changes
> in a range.
>
> Move the error handling and completing of the struct into the
> 'parse_git_diff_header' function, so other callers can take advantage
> of it. This fixes the segfault in 'git range-diff'.
>
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>This patch also makes git work again for the originally problematic usecase.
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks for your quick reaction to my bug report, Uwe Kleine-König
-- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |