Issue #7019: Unmarshalling of bad long data could produce unnormalized
PyLongs. Raise ValueError instead.
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index 0cd46a2..7669182 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -262,6 +262,11 @@
testString = 'abc' * size
marshal.dumps(testString)
+ def test_invalid_longs(self):
+ # Issue #7019: marshal.loads shouldn't produce unnormalized PyLongs
+ invalid_string = 'l\x02\x00\x00\x00\x00\x00\x00\x00'
+ self.assertRaises(ValueError, marshal.loads, invalid_string)
+
def test_main():
test_support.run_unittest(IntTestCase,