diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-26 20:45:00 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-26 20:45:00 (GMT) |
commit | 9ee5c37c8f8c4f35814453aecf5fdfd01dfa2781 (patch) | |
tree | 654919eea8c2eb90e2218c337af60981c0d583e3 /Modules | |
parent | 66eda26a72f052ac97512037a682bb08974681a6 (diff) | |
download | cpython-9ee5c37c8f8c4f35814453aecf5fdfd01dfa2781.zip cpython-9ee5c37c8f8c4f35814453aecf5fdfd01dfa2781.tar.gz cpython-9ee5c37c8f8c4f35814453aecf5fdfd01dfa2781.tar.bz2 |
Issue #18559: Fix NULL pointer dereference error in _pickle module
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_pickle.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 0252c62..ce573cf 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -4816,9 +4816,10 @@ load_binget(UnpicklerObject *self) value = _Unpickler_MemoGet(self, idx); if (value == NULL) { PyObject *key = PyLong_FromSsize_t(idx); - if (!PyErr_Occurred()) + if (key != NULL) { PyErr_SetObject(PyExc_KeyError, key); - Py_DECREF(key); + Py_DECREF(key); + } return -1; } @@ -4841,9 +4842,10 @@ load_long_binget(UnpicklerObject *self) value = _Unpickler_MemoGet(self, idx); if (value == NULL) { PyObject *key = PyLong_FromSsize_t(idx); - if (!PyErr_Occurred()) + if (key != NULL) { PyErr_SetObject(PyExc_KeyError, key); - Py_DECREF(key); + Py_DECREF(key); + } return -1; } |