Skip to content

Commit e44da1b

Browse files
committed
Merge branch 'jk/cache-tree-protect-from-broken-libgit2'
The code to use cache-tree trusted the on-disk data too much and fell into an infinite loop. * jk/cache-tree-protect-from-broken-libgit2: cache-tree: avoid infinite loop on zero-entry tree
2 parents f745acb + 729dbbd commit e44da1b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cache-tree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ static int update_one(struct cache_tree *it,
303303
flags);
304304
if (subcnt < 0)
305305
return subcnt;
306+
if (!subcnt)
307+
die("index cache-tree records empty sub-tree");
306308
i += subcnt;
307309
sub->count = subcnt; /* to be used in the next loop */
308310
*skip_count += subskip;

0 commit comments

Comments
 (0)