You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> pickle.loads(b'(o.\x7f.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: Objects/tupleobject.c:71: bad argument to internal function
Warning: The pickle module is not intended to be secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source.
Here is a patch that makes broken OBJ opcode to raise UnpicklingError instead of SystemError, improves some UnpicklingError messages, and adds tests for unpickling broken data.
This broke test_xpickle with python 2.4 and 2.5 due to 'b' prefixes and an import that's not actually used in the 2.7 patch; now fixed. The ware-gentoo-x86 buildslave now has pythons 2.4, 2.5, and 2.6 installed for test_xpickle to use.
Activity
alex commentedon Apr 11, 2015
>>> pickle.loads(b'(o.\x7f.') Traceback (most recent call last): File "<stdin>", line 1, in <module> SystemError: Objects/tupleobject.c:71: bad argument to internal function(Or the equivalent using cPickle on Python 2)
Found using http://lcamtuf.coredump.cx/afl/
serhiy-storchaka commentedon Apr 11, 2015
Warning: The pickle module is not intended to be secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source.
alex commentedon Apr 11, 2015
Yes, it can execute arbitrary code, but I think we should prefer raising "specific" error messages, instead of failing inside tuple details.
bitdancer commentedon Apr 11, 2015
I dob't see a strong motivation to do that. What's the use case?
serhiy-storchaka commentedon Nov 14, 2015
Here is a patch that makes broken OBJ opcode to raise UnpicklingError instead of SystemError, improves some UnpicklingError messages, and adds tests for unpickling broken data.
python-dev commentedon Nov 23, 2015
New changeset bac3f63ea747 by Serhiy Storchaka in branch '3.4':
Issue bpo-23914: Fixed SystemError raised by unpickler on broken pickle data.
https://hg.python.org/cpython/rev/bac3f63ea747
New changeset 531e2674f003 by Serhiy Storchaka in branch '3.5':
Issue bpo-23914: Fixed SystemError raised by unpickler on broken pickle data.
https://hg.python.org/cpython/rev/531e2674f003
New changeset b08c3a733fda by Serhiy Storchaka in branch 'default':
Issue bpo-23914: Fixed SystemError raised by unpickler on broken pickle data.
https://hg.python.org/cpython/rev/b08c3a733fda
New changeset 686fa9439d38 by Serhiy Storchaka in branch '2.7':
Issue bpo-23914: Fixed SystemError raised by unpickler on broken pickle data.
https://hg.python.org/cpython/rev/686fa9439d38
python-dev commentedon Nov 27, 2015
New changeset 322060740b64 by Zachary Ware in branch '2.7':
Issue bpo-23914: Fix test_xpickle with python 2.4 and 2.5
https://hg.python.org/cpython/rev/322060740b64
zware commentedon Nov 27, 2015
This broke test_xpickle with python 2.4 and 2.5 due to 'b' prefixes and an import that's not actually used in the 2.7 patch; now fixed. The ware-gentoo-x86 buildslave now has pythons 2.4, 2.5, and 2.6 installed for test_xpickle to use.
serhiy-storchaka commentedon Nov 27, 2015
Great! I afraid there were no buildbots with 2.4 and 2.5 for testing test_xpickle. Thank you Zachary!