This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pickle: Missing NULL check in save_global()
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: izbyshev, miss-islington, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-08-21 23:15 by izbyshev, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8851 merged izbyshev, 2018-08-21 23:17
PR 8853 merged miss-islington, 2018-08-22 04:51
PR 8854 merged miss-islington, 2018-08-22 04:51
Messages (7)
msg323853 - (view) Author: Alexey Izbyshev (izbyshev) * (Python triager) Date: 2018-08-21 23:15
The return value of Py_BuildValue() is dereferenced without checking at https://github.com/python/cpython/blob/ef8861c112ed1dac9351958c121bc24ca4ecdb08/Modules/_pickle.c#L3457

Reported by Svace static analyzer.
msg323861 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-08-22 04:51
New changeset f8c06b028036e50596e75d4c9f6b27ba05133efe by Serhiy Storchaka (Alexey Izbyshev) in branch 'master':
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
https://github.com/python/cpython/commit/f8c06b028036e50596e75d4c9f6b27ba05133efe
msg323864 - (view) Author: miss-islington (miss-islington) Date: 2018-08-22 05:54
New changeset 3152bc36fd1a8ab349d6802e9b48dd88a35b3620 by Miss Islington (bot) in branch '3.7':
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
https://github.com/python/cpython/commit/3152bc36fd1a8ab349d6802e9b48dd88a35b3620
msg323865 - (view) Author: miss-islington (miss-islington) Date: 2018-08-22 05:54
New changeset b14a68fd7d8f02bd133b59709f969c1c564f5978 by Miss Islington (bot) in branch '3.6':
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
https://github.com/python/cpython/commit/b14a68fd7d8f02bd133b59709f969c1c564f5978
msg323876 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-08-22 12:58
Is 2.7 affected?
msg323877 - (view) Author: Alexey Izbyshev (izbyshev) * (Python triager) Date: 2018-08-22 13:17
No, I couldn't find any similar calls in save_global() in 2.7.

However, there is Py_BuildValue() call in initcPickle(), and its result is passed unchecked to PyDict_SetItemString(), where it's eventually dereferenced. In fact, all PyDict_SetItemString() calls in initcPickle() are made without checking for NULL. Should I file an issue for that?
msg324007 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-08-24 16:15
We don't bother to fix low probably bugs in 2.7 if the code is too different from 3.x. But if you create a PR it will be merged. Seems this should be a separate issue.
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78637
2018-08-24 16:15:46serhiy.storchakasetmessages: + msg324007
2018-08-22 13:17:26izbyshevsetmessages: + msg323877
2018-08-22 12:58:00serhiy.storchakasetmessages: + msg323876
2018-08-22 12:37:16izbyshevsetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: - Python 3.5
2018-08-22 05:54:41miss-islingtonsetmessages: + msg323865
2018-08-22 05:54:36miss-islingtonsetnosy: + miss-islington
messages: + msg323864
2018-08-22 04:51:54miss-islingtonsetpull_requests: + pull_request8326
2018-08-22 04:51:46miss-islingtonsetpull_requests: + pull_request8325
2018-08-22 04:51:30serhiy.storchakasetmessages: + msg323861
2018-08-21 23:17:10izbyshevsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8323
2018-08-21 23:15:26izbyshevcreate