mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
#4298: pickle.load() can segfault on invalid or truncated input.
Patch and test by Hirokazu Yamamoto.
This commit is contained in:
parent
3bae65bacd
commit
3e4e72f66f
3 changed files with 13 additions and 1 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue