]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34987: Fix a possible null pointer dereference in _pickle.c's save_reduce()....
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 5 Dec 2018 19:35:47 +0000 (11:35 -0800)
committerGitHub <noreply@github.com>
Wed, 5 Dec 2018 19:35:47 +0000 (11:35 -0800)
(cherry picked from commit 25d389789c59a52a31770f7c50ce9e02a8909190)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Modules/_pickle.c

index 389bb6701c5f52ee61828fc36939d6aae2e7f38c..8c8163560f1188dee7a857a65b6b26b854fac494 100644 (file)
@@ -3743,7 +3743,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 "