Skip to content

Commit

Permalink
Merge branch 'jk/cache-tree-protect-from-broken-libgit2'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Nov 6, 2014
2 parents f745acb + 729dbbd commit e44da1b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cache-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ static int update_one(struct cache_tree *it,
flags);
if (subcnt < 0)
return subcnt;
if (!subcnt)
die("index cache-tree records empty sub-tree");
i += subcnt;
sub->count = subcnt; /* to be used in the next loop */
*skip_count += subskip;
Expand Down

0 comments on commit e44da1b

Please sign in to comment.