Skip to content

Commit b14a68f

Browse files
miss-islingtonAlexey Izbyshev
andauthored
bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)
Reported by Svace static analyzer. (cherry picked from commit f8c06b0) Co-authored-by: Alexey Izbyshev <[email protected]>
1 parent e496b2b commit b14a68f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/_pickle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3349,6 +3349,8 @@ save_global(PicklerObject *self, PyObject *obj, PyObject *name)
33493349
PickleState *st = _Pickle_GetGlobalState();
33503350
PyObject *reduce_value = Py_BuildValue("(O(OO))",
33513351
st->getattr, parent, lastname);
3352+
if (reduce_value == NULL)
3353+
goto error;
33523354
status = save_reduce(self, reduce_value, NULL);
33533355
Py_DECREF(reduce_value);
33543356
if (status < 0)

0 commit comments

Comments
 (0)