[Python-checkins] bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
Miss Islington (bot)
webhook-mailer at python.org
Wed Aug 22 01:54:36 EDT 2018
https://github.com/python/cpython/commit/3152bc36fd1a8ab349d6802e9b48dd88a35b3620
commit: 3152bc36fd1a8ab349d6802e9b48dd88a35b3620
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-08-22T01:54:33-04:00
summary:
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
Reported by Svace static analyzer.
(cherry picked from commit f8c06b028036e50596e75d4c9f6b27ba05133efe)
Co-authored-by: Alexey Izbyshev <izbyshev at ispras.ru>
files:
M Modules/_pickle.c
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 40b29a7d6936..fc119c0caa49 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -3452,6 +3452,8 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
PickleState *st = _Pickle_GetGlobalState();
PyObject *reduce_value = Py_BuildValue("(O(OO))",
st->getattr, parent, lastname);
+ if (reduce_value == NULL)
+ goto error;
status = save_reduce(self, reduce_value, NULL);
Py_DECREF(reduce_value);
if (status < 0)
More information about the Python-checkins
mailing list