From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 5 Dec 2018 19:35:47 +0000 (-0800) Subject: bpo-34987: Fix a possible null pointer dereference in _pickle.c's save_reduce().... X-Git-Tag: v3.6.8rc1~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=92d912c344e6c21de46da29f0dc45b7e476fa79d;p=thirdparty%2FPython%2Fcpython.git bpo-34987: Fix a possible null pointer dereference in _pickle.c's save_reduce(). (GH-9886) (cherry picked from commit 25d389789c59a52a31770f7c50ce9e02a8909190) Co-authored-by: Zackery Spytz --- diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 389bb6701c5f..8c8163560f11 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -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 "