Re: [PATCH 1/2] apply: guard against renames of non-existant empty files

2017-06-27 Thread René Scharfe
Am 27.02.2017 um 23:18 schrieb René Scharfe: > Am 27.02.2017 um 21:10 schrieb Junio C Hamano: >> René Scharfe writes: >> >>> Would it make sense to mirror the previously existing condition and >>> check for is_new instead? I.e.: >>> >>> if ((!patch->is_delete &&

Re: [PATCH 1/2] apply: guard against renames of non-existant empty files

2017-02-27 Thread René Scharfe
Am 27.02.2017 um 21:10 schrieb Junio C Hamano: René Scharfe writes: Would it make sense to mirror the previously existing condition and check for is_new instead? I.e.: if ((!patch->is_delete && !patch->new_name) ||

Re: [PATCH 1/2] apply: guard against renames of non-existant empty files

2017-02-27 Thread Junio C Hamano
René Scharfe writes: > Would it make sense to mirror the previously existing condition and > check for is_new instead? I.e.: > > if ((!patch->is_delete && !patch->new_name) || > (!patch->is_new&& !patch->old_name)) { > Yes,

Re: [PATCH 1/2] apply: guard against renames of non-existant empty files

2017-02-25 Thread René Scharfe
Am 25.02.2017 um 11:13 schrieb Vegard Nossum: If we have a patch like the one in the new test-case, then we will try to rename a non-existant empty file, i.e. patch->old_name will be NULL. In this case, a NULL entry will be added to fn_table, which is not allowed (a subsequent binary search will

Re: [PATCH 1/2] apply: guard against renames of non-existant empty files

2017-02-25 Thread Philip Oakley
From: "Vegard Nossum" On 25/02/2017 12:59, Philip Oakley wrote: From: "Vegard Nossum" If we have a patch like the one in the new test-case, then we will "the one in the new test-case" needs a clearer reference to the particular case so

Re: [PATCH 1/2] apply: guard against renames of non-existant empty files

2017-02-25 Thread Vegard Nossum
On 25/02/2017 12:59, Philip Oakley wrote: From: "Vegard Nossum" If we have a patch like the one in the new test-case, then we will "the one in the new test-case" needs a clearer reference to the particular case so that future readers will know what it refers to.

Re: [PATCH 1/2] apply: guard against renames of non-existant empty files

2017-02-25 Thread Philip Oakley
From: "Vegard Nossum" If we have a patch like the one in the new test-case, then we will "the one in the new test-case" needs a clearer reference to the particular case so that future readers will know what it refers to. Noticed while browsing the commit message..

[PATCH 1/2] apply: guard against renames of non-existant empty files

2017-02-25 Thread Vegard Nossum
If we have a patch like the one in the new test-case, then we will try to rename a non-existant empty file, i.e. patch->old_name will be NULL. In this case, a NULL entry will be added to fn_table, which is not allowed (a subsequent binary search will die with a NULL pointer dereference). The