diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-12-05 11:35:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-05 11:35:41 -0800 |
commit | e2f376f284b7bf1388d85e99dce646cabc507016 (patch) | |
tree | 454d51ae543140ef4ecaacf6d71dab92f4ed8bdd /Modules/_pickle.c | |
parent | 983d1ab0e6f4280f954bcba87db76e11131f1c33 (diff) | |
download | cpython-git-e2f376f284b7bf1388d85e99dce646cabc507016.tar.gz |
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 <zspytz@gmail.com>
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r-- | Modules/_pickle.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c index a1a90bd95c..57bb771add 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -3838,7 +3838,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 " |