Re: [RFC/PATCH] cache-tree: avoid infinite loop on zero-entry tree

2014-10-29 Thread Jeff King
On Wed, Oct 29, 2014 at 11:50:12AM -0700, Junio C Hamano wrote: > Jeff King writes: > > > I'm a little iffy on this just because it is fixing one particular bug, > > and I am sure there are probably a bunch of other ways to have a bogus > > index. Fundamentally, I think we pretty much trust that

Re: [RFC/PATCH] cache-tree: avoid infinite loop on zero-entry tree

2014-10-29 Thread Junio C Hamano
Jeff King writes: > I'm a little iffy on this just because it is fixing one particular bug, > and I am sure there are probably a bunch of other ways to have a bogus > index. Fundamentally, I think we pretty much trust that the index was > not maliciously generated (unlike packfiles, for instance,

[RFC/PATCH] cache-tree: avoid infinite loop on zero-entry tree

2014-10-29 Thread Jeff King
The loop in cache-tree's update_one iterates over all the entries in the index. For each one, we find the cache-tree subtree which represents our path (creating it if necessary), and then recurse into update_one again. The return value we get is the number of index entries that belonged in that sub