mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 13:33:09 +00:00
immutable: raise a LayoutInvalid exception instead of an AssertionError if the share is corrupted so that the sharehashtree is the wrong size
This commit is contained in:
parent
98b28c1d5e
commit
f4fab23bf6
@ -414,7 +414,8 @@ class ReadBucketProxy:
|
||||
end of the share, so we need to use the offset and read just that much."""
|
||||
offset = self._offsets['share_hashes']
|
||||
size = self._offsets['uri_extension'] - offset
|
||||
assert size % (2+HASH_SIZE) == 0
|
||||
if size % (2+HASH_SIZE) != 0:
|
||||
raise LayoutInvalid("share hash tree corrupted -- should occupy a multiple of %d bytes, not %d bytes" % ((2+HASH_SIZE), size))
|
||||
d = self._read(offset, size)
|
||||
def _unpack_share_hashes(data):
|
||||
assert len(data) == size
|
||||
|
Loading…
Reference in New Issue
Block a user