Browse code

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

Junio C Hamano authored on 06/11/2014 18:51:35
Showing 1 changed files
... ...
@@ -303,6 +303,8 @@ static int update_one(struct cache_tree *it,
303 303
 				    flags);
304 304
 		if (subcnt < 0)
305 305
 			return subcnt;
306
+		if (!subcnt)
307
+			die("index cache-tree records empty sub-tree");
306 308
 		i += subcnt;
307 309
 		sub->count = subcnt; /* to be used in the next loop */
308 310
 		*skip_count += subskip;