Re: [PATCH 4/4] worktree: handle broken symrefs in find_shared_symref()

2017-10-21 Thread Junio C Hamano
Jeff King writes: > On Sat, Oct 21, 2017 at 06:49:15AM -0400, Eric Sunshine wrote: > >> On Thu, Oct 19, 2017 at 1:49 PM, Jeff King wrote: >> > The refs_resolve_ref_unsafe() function may return NULL even >> > with a REF_ISSYMREF flag if a symref points to a broken ref. >> > As a result, it's poss

Re: [PATCH 4/4] worktree: handle broken symrefs in find_shared_symref()

2017-10-21 Thread Jeff King
On Sat, Oct 21, 2017 at 06:49:15AM -0400, Eric Sunshine wrote: > On Thu, Oct 19, 2017 at 1:49 PM, Jeff King wrote: > > The refs_resolve_ref_unsafe() function may return NULL even > > with a REF_ISSYMREF flag if a symref points to a broken ref. > > As a result, it's possible for find_shared_symref

Re: [PATCH 4/4] worktree: handle broken symrefs in find_shared_symref()

2017-10-21 Thread Eric Sunshine
On Thu, Oct 19, 2017 at 1:49 PM, Jeff King wrote: > The refs_resolve_ref_unsafe() function may return NULL even > with a REF_ISSYMREF flag if a symref points to a broken ref. > As a result, it's possible for find_shared_symref() to > segfault when it passes NULL to strcmp(). > [...] > We can fix t

[PATCH 4/4] worktree: handle broken symrefs in find_shared_symref()

2017-10-19 Thread Jeff King
The refs_resolve_ref_unsafe() function may return NULL even with a REF_ISSYMREF flag if a symref points to a broken ref. As a result, it's possible for find_shared_symref() to segfault when it passes NULL to strcmp(). This is hard to trigger for most code paths. We typically pass HEAD to the funct