]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
immutable: handle another form of share corruption with LayoutInvalid exception inste...
authorZooko O'Whielacronx <zooko@zooko.com>
Tue, 6 Jan 2009 00:46:45 +0000 (17:46 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Tue, 6 Jan 2009 00:46:45 +0000 (17:46 -0700)
src/allmydata/immutable/download.py

index 595818ecee53ccb32bf78ab986c0caa0f137757b..ed9b77d44f68879ae7941b18ef116f2df9cda1ba 100644 (file)
@@ -404,7 +404,12 @@ class ValidatedReadBucketProxy(log.PrefixingLogMixin):
             if self.share_hash_tree.needed_hashes(self.sharenum):
                 # This will raise exception if the values being passed do not match the root
                 # node of self.share_hash_tree.
-                self.share_hash_tree.set_hashes(sharehashes)
+                try:
+                    self.share_hash_tree.set_hashes(sharehashes)
+                except IndexError, le:
+                    # Weird -- sharehashes contained index numbers outside of the range that fit
+                    # into this hash tree.
+                    raise BadOrMissingHash(le)
 
             # To validate a block we need the root of the block hash tree, which is also one of
             # the leafs of the share hash tree, and is called "the share hash".