mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #7455: Fix possible crash in cPickle on invalid input. Patch by
Florent Xicluna.
This commit is contained in:
parent
bdd863d062
commit
0d423b870b
3 changed files with 13 additions and 1 deletions
|
|
@ -1100,6 +1100,15 @@ class AbstractPickleModuleTests(unittest.TestCase):
|
|||
exec teststr in {'__builtins__': builtins}, d
|
||||
d['f']()
|
||||
|
||||
def test_bad_input(self):
|
||||
# Test issue4298
|
||||
s = '\x58\0\0\0\x54'
|
||||
self.assertRaises(EOFError, self.module.loads, s)
|
||||
# Test issue7455
|
||||
s = '0'
|
||||
# XXX Why doesn't pickle raise UnpicklingError?
|
||||
self.assertRaises((IndexError, cPickle.UnpicklingError),
|
||||
self.module.loads, s)
|
||||
|
||||
class AbstractPersistentPicklerTests(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue