summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-11-11 20:05:06 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-11-11 20:05:06 (GMT)
commit3e4e72f66f4e9d379d7734b5d0de92fc0b4d9596 (patch)
tree4eee1f9789483a66f079269f0c3c2f194b5910be /Lib
parent3bae65bacdc7c03e665fabb2065c740358ac362f (diff)
downloadcpython-3e4e72f66f4e9d379d7734b5d0de92fc0b4d9596.zip
cpython-3e4e72f66f4e9d379d7734b5d0de92fc0b4d9596.tar.gz
cpython-3e4e72f66f4e9d379d7734b5d0de92fc0b4d9596.tar.bz2
#4298: pickle.load() can segfault on invalid or truncated input.
Patch and test by Hirokazu Yamamoto.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/pickletester.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 8519fb5..c7c89d1 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -1032,6 +1032,11 @@ class AbstractPickleModuleTests(unittest.TestCase):
self.assertRaises(pickle.PicklingError, BadPickler().dump, 0)
self.assertRaises(pickle.UnpicklingError, BadUnpickler().load)
+ def test_bad_input(self):
+ # Test issue4298
+ s = bytes([0x58, 0, 0, 0, 0x54])
+ self.assertRaises(EOFError, pickle.loads, s)
+
class AbstractPersistentPicklerTests(unittest.TestCase):