From: Eric Sunshine Date: Sun, 23 Aug 2020 03:08:06 GMT Subject: Re: [PATCH] Avoid infinite loop in malformed packfiles Message-ID: In-Reply-To: <20200823005236.10386-1-ori@eigenstate.org> On Sat, Aug 22, 2020 at 8:59 PM Ori Bernstein wrote: > In packfile.c:1680, there's an infinite loop that tries to get > to the base of a packfile. With offset deltas, the offset needs > to be greater than 0, so it's always walking backwards, and the > search is guaranteed to terminate. > > With reference deltas, there's no check for a cycle in the > references, so a cyclic reference will cause git to loop > infinitely, growing the delta_stack infinitely, which will > cause it to consume all available memory as as a full CPU > core. > > This change puts an arbitrary limit of 10,000 on the number > of iterations we make when chasing down a base commit, to > prevent looping forever, using all available memory growing > the delta stack. > --- Missing sign-off.