New submission from Serhiy Storchaka:

>>> import cPickle
>>> cPickle.loads(b"S' \np0\n.")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: Negative size passed to PyString_FromStringAndSize
>>> pickle.loads(b"S' \np0\n.")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython2.7/Lib/pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "/home/serhiy/py/cpython2.7/Lib/pickle.py", line 858, in load
    dispatch[key](self)
  File "/home/serhiy/py/cpython2.7/Lib/pickle.py", line 966, in load_string
    raise ValueError, "insecure string pickle"
ValueError: insecure string pickle
>>> cPickle.loads(b"S'\np0\n.")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: Negative size passed to PyString_FromStringAndSize
>>> pickle.loads(b"S'\np0\n.")
''

Python 3 has the same behavior except C implementation raises UnpicklingError 
for b"S'\np0\n.".

----------
components: Extension Modules
messages: 186704
nosy: alexandre.vassalotti, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: SystemError in cPickle for incorrect input
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17710>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to