[Python-checkins] bpo-34987: Fix a possible null pointer dereference in _pickle.c's save_reduce(). (GH-9886)

Serhiy Storchaka webhook-mailer at python.org
Wed Dec 5 13:29:26 EST 2018


https://github.com/python/cpython/commit/25d389789c59a52a31770f7c50ce9e02a8909190
commit: 25d389789c59a52a31770f7c50ce9e02a8909190
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-12-05T20:29:20+02:00
summary:

bpo-34987: Fix a possible null pointer dereference in _pickle.c's save_reduce(). (GH-9886)

files:
M Modules/_pickle.c

diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 39f8b750ed64..c4fe349187c4 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 "



More information about the Python-checkins mailing list