storage.py: assert that immutable share size will fit in the 4-byte v1 container...
authorBrian Warner <warner@lothar.com>
Mon, 20 Oct 2008 17:22:08 +0000 (10:22 -0700)
committerBrian Warner <warner@lothar.com>
Mon, 20 Oct 2008 17:22:08 +0000 (10:22 -0700)
src/allmydata/storage.py

index 59d671da45c92d6c8c84c0fc48077b628685199d..8098edbc0be1227f03733716d16b63b92ff27612 100644 (file)
@@ -236,6 +236,7 @@ class BucketWriter(Referenceable):
         fileutil.make_dirs(os.path.dirname(incominghome))
         # Also construct the metadata.
         f = open(incominghome, 'wb')
+        precondition(size < 2**32) # v1 container format: 4-byte size field
         f.write(struct.pack(">LLL", 1, size, 0))
         f.close()
         self._sharefile = ShareFile(incominghome)