]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
immutable: defensive programming: assert that the encrypted readable gave you no...
authorZooko O'Whielacronx <zooko@zooko.com>
Tue, 10 Feb 2009 06:46:05 +0000 (23:46 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Tue, 10 Feb 2009 06:46:05 +0000 (23:46 -0700)
(There is a bug in the current DownUpConnector which can cause it to give more bytes than you asked for on one request, and then less on the next, effectively shifting some of the bytes to an earlier request, but I think this bug never gets triggered in practice.)

src/allmydata/immutable/encode.py

index 3ef9f3ae1fc85a01ba03ac4ffa088af505274066..e13ea7cd29145fc033647aa4d7ac6f20bf572bad 100644 (file)
@@ -389,6 +389,9 @@ class Encoder(object):
                 self._crypttext_hasher.update(encrypted_piece)
                 encrypted_pieces.append(encrypted_piece)
 
+            precondition(length <= input_chunk_size,
+                         "length=%d > input_chunk_size=%d" %
+                         (length, input_chunk_size))
             if allow_short:
                 if length < input_chunk_size:
                     # padding