summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-12-05 18:29:20 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-12-05 18:29:20 (GMT)
commit25d389789c59a52a31770f7c50ce9e02a8909190 (patch)
treee51c7698227b8a3b3b135345ec110dcfd7f4acfe /Modules/_pickle.c
parent5b25f1d03100e2283c1b129d461ba68ac0169a14 (diff)
downloadcpython-25d389789c59a52a31770f7c50ce9e02a8909190.zip
cpython-25d389789c59a52a31770f7c50ce9e02a8909190.tar.gz
cpython-25d389789c59a52a31770f7c50ce9e02a8909190.tar.bz2
bpo-34987: Fix a possible null pointer dereference in _pickle.c's save_reduce(). (GH-9886)
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 39f8b75..c4fe349 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -3840,7 +3840,10 @@ save_reduce(PicklerObject *self, PyObject *args, PyObject *obj)
if (obj != NULL) {
obj_class = get_class(obj);
- p = obj_class != cls; /* true iff a problem */
+ if (obj_class == NULL) {
+ return -1;
+ }
+ p = obj_class != cls;
Py_DECREF(obj_class);
if (p) {
PyErr_SetString(st->PicklingError, "args[0] from "