Re: [PATCH] fix "git apply --index ..." not to deref NULL
On Wed, Oct 12, 2011 at 10:18:01AM +0200, Jim Meyering wrote:
Show 10 quoted lines
> 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