From: Zooko O'Whielacronx Date: Sat, 3 Jan 2009 01:57:45 +0000 (-0700) Subject: immutable: fix detection of truncated shares to take into account the fieldsize ... X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/flags/architecture.txt?a=commitdiff_plain;h=54787771c308ee59d8197666f4a61aafb59b9050;p=tahoe-lafs%2Ftahoe-lafs.git immutable: fix detection of truncated shares to take into account the fieldsize -- either 4 or 8 --- diff --git a/src/allmydata/immutable/layout.py b/src/allmydata/immutable/layout.py index 16b91c59..1f5de5ab 100644 --- a/src/allmydata/immutable/layout.py +++ b/src/allmydata/immutable/layout.py @@ -371,8 +371,8 @@ class ReadBucketProxy: offset = self._offsets['uri_extension'] d = self._read(offset, self._fieldsize) def _got_length(data): - if len(data) != 4: - raise LayoutInvalid("not enough bytes to encode URI length -- %d" % (len(data),)) + if len(data) != self._fieldsize: + raise LayoutInvalid("not enough bytes to encode URI length -- should be %d bytes long, not %d " % (self._fieldsize, len(data),)) length = struct.unpack(self._fieldstruct, data)[0] if length >= 2**31: # URI extension blocks are around 419 bytes long, so this must be corrupted.