summaryrefslogtreecommitdiff
path: root/cache-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-11-06 10:51:35 -0800
committerJunio C Hamano <gitster@pobox.com>2014-11-06 10:51:35 -0800
commite44da1bbb83f8dac4ea2ae7c806383af470edd38 (patch)
tree668b6fa4c0700310020ef58465f0cb83773a06a9 /cache-tree.c
parentf745acb028ee8f7dcd1c8f10127b8feeaa255cf7 (diff)
parent729dbbd9fc715fac1fc7cd8b603f0a7d625f2dfc (diff)
downloadgit-e44da1bbb83f8dac4ea2ae7c806383af470edd38.tar.gz
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
Diffstat (limited to 'cache-tree.c')
-rw-r--r--cache-tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cache-tree.c b/cache-tree.c
index 215202c42d..32772b9564 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -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;