]> arthur.barton.de Git - bup.git/commitdiff
Fix off-by-one in MAX_PER_TREE guard in _squish().
authorRob Browning <rlb@defaultvalue.org>
Sat, 23 Nov 2013 19:15:45 +0000 (13:15 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 23 Nov 2013 19:15:48 +0000 (13:15 -0600)
Previously bup would allow MAX_PER_TREE + 1 items in a tree.  Change
the guard to ensure that trees really are limited to MAX_PER_TREE.

Thanks to Patrick Rouleau <prouleau72@gmail.com> for reporting the
problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/hashsplit.py

index 3dffbbe857874c3142d054d3b3cd15d9bd22c4d9..345f67bc097273dc10ee3732d58320f8ec31de26 100644 (file)
@@ -133,7 +133,7 @@ def _make_shalist(l):
 
 def _squish(maketree, stacks, n):
     i = 0
-    while i<n or len(stacks[i]) > MAX_PER_TREE:
+    while i < n or len(stacks[i]) >= MAX_PER_TREE:
         while len(stacks) <= i+1:
             stacks.append([])
         if len(stacks[i]) == 1: