summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-08-29 22:28:40 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-08-29 22:28:40 (GMT)
commita514eb95f30306a11a14f8a3b9cbf229c6af6137 (patch)
tree9448e0e80659d32aa1c11e78c905e21a87ca320d /Lib/test/pickletester.py
parentee763e2acc469fa2f423440517b9bc227fbbe79c (diff)
parent55549ec476c178ca4723ba97d4f00a015f427427 (diff)
downloadcpython-a514eb95f30306a11a14f8a3b9cbf229c6af6137.zip
cpython-a514eb95f30306a11a14f8a3b9cbf229c6af6137.tar.gz
cpython-a514eb95f30306a11a14f8a3b9cbf229c6af6137.tar.bz2
Issue #12847: Fix a crash with negative PUT and LONG_BINPUT arguments in
the C pickle implementation.
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r--Lib/test/pickletester.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 807221a..f4b50aa 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -1150,6 +1150,18 @@ class AbstractPickleTests(unittest.TestCase):
# On 32-bit builds, a BINUNICODE of 2**31 or more is refused
self.check_negative_32b_binXXX(b'\x80\x03X\xff\xff\xff\xffxyzq\x00.')
+ def test_negative_put(self):
+ # Issue #12847
+ dumped = b'Va\np-1\n.'
+ self.assertRaises(ValueError, self.loads, dumped)
+
+ def test_negative_32b_binput(self):
+ # Issue #12847
+ if sys.maxsize > 2**32:
+ self.skipTest("test is only meaningful on 32-bit builds")
+ dumped = b'\x80\x03X\x01\x00\x00\x00ar\xff\xff\xff\xff.'
+ self.assertRaises(ValueError, self.loads, dumped)
+
class BigmemPickleTests(unittest.TestCase):