From 0832334c0d3fb88001b52c999bf05901f8c02100 Mon Sep 17 00:00:00 2001 From: Brian Warner <warner@lothar.com> Date: Mon, 20 Oct 2008 10:22:08 -0700 Subject: [PATCH] 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 --- src/allmydata/storage.py | 1 + 1 file changed, 1 insertion(+) 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) -- 2.45.2