]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34987: Fix a possible null pointer dereference in _pickle.c's save_reduce()....
authorZackery Spytz <zspytz@gmail.com>
Wed, 5 Dec 2018 18:29:20 +0000 (11:29 -0700)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 5 Dec 2018 18:29:20 +0000 (20:29 +0200)
Modules/_pickle.c

index 39f8b750ed643a29ae944b4b087e540766452d05..c4fe349187c488868ea0b25fc714f7beb0530855 100644 (file)
@@ -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 "