From: Brian Warner Date: Mon, 20 Oct 2008 17:22:08 +0000 (-0700) Subject: storage.py: assert that immutable share size will fit in the 4-byte v1 container... X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/%22file:/statistics?a=commitdiff_plain;h=0832334c0d3fb88001b52c999bf05901f8c02100;p=tahoe-lafs%2Ftahoe-lafs.git storage.py: assert that immutable share size will fit in the 4-byte v1 container (see #346). The struct module in py2.4 raises an error on overflow, but py2.5 merely emits a warning --- diff --git a/src/allmydata/storage.py b/src/allmydata/storage.py index 59d671da..8098edbc 100644 --- a/src/allmydata/storage.py +++ b/src/allmydata/storage.py @@ -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)