summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-10-03 08:15:49 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-10-03 08:15:49 (GMT)
commitc3a12775e26f8c8f4148cb247dc88bc38f05dc58 (patch)
tree09ad84efb85f3136839cbeb285f05a9f7916fb6e /Lib
parent7664bfe4e2540f07651372075d3179ab2f93988b (diff)
downloadcpython-c3a12775e26f8c8f4148cb247dc88bc38f05dc58.zip
cpython-c3a12775e26f8c8f4148cb247dc88bc38f05dc58.tar.gz
cpython-c3a12775e26f8c8f4148cb247dc88bc38f05dc58.tar.bz2
Issue #7019: An attempt to unmarshal bad long data could produce
unnormalized PyLong objects; make it raise ValueError instead.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_marshal.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index 943aa55..0dd59d1 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -262,6 +262,11 @@ class BugsTestCase(unittest.TestCase):
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,