summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_struct.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r--Lib/test/test_struct.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 684dc6c..6032895 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -511,6 +511,13 @@ class StructTest(unittest.TestCase):
for c in [b'\x01', b'\x7f', b'\xff', b'\x0f', b'\xf0']:
self.assertTrue(struct.unpack('>?', c)[0])
+ def test_count_overflow(self):
+ hugecount = '{}b'.format(sys.maxsize+1)
+ self.assertRaises(struct.error, struct.calcsize, hugecount)
+
+ hugecount2 = '{}b{}H'.format(sys.maxsize//2, sys.maxsize//2)
+ self.assertRaises(struct.error, struct.calcsize, hugecount2)
+
if IS32BIT:
def test_crasher(self):
self.assertRaises(MemoryError, struct.pack, "357913941b", "a")