From: Jeff King Date: Wed, 12 Oct 2011 14:27:50 GMT Subject: Re: [PATCH] fix "git apply --index ..." not to deref NULL Message-ID: <20111012142750.GB25085@sigill.intra.peff.net> In-Reply-To: <87lisq8vye.fsf@rho.meyering.net> On Wed, Oct 12, 2011 at 10:18:01AM +0200, Jim Meyering wrote: > I noticed this when "git am CORRUPTED" unexpectedly failed with an > odd diagnostic, and even removed one of the files it was supposed > to have patched. > > Reproduce with any valid old/new patch from which you have removed > the "+++ b/FILE" line. You'll see a diagnostic like this > > fatal: unable to write file '(null)' mode 100644: Bad address > > and you'll find that FILE has been removed. Yikes. Your fix looks right to me. > builtin/apply.c | 3 +++ > t/t4254-am-corrupt.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+), 0 deletions(-) > create mode 100644 t/t4254-am-corrupt.sh Missing executable bit on the new test. -Peff