Commit 9ee5c37c authored by Christian Heimes's avatar Christian Heimes

Issue #18559: Fix NULL pointer dereference error in _pickle module

parent 66eda26a
...@@ -52,6 +52,8 @@ Core and Builtins ...@@ -52,6 +52,8 @@ Core and Builtins
Library Library
------- -------
- Issue #18559: Fix NULL pointer dereference error in _pickle module
- Issue #18556: Check the return value of a PyUnicode_AsWideChar() call in - Issue #18556: Check the return value of a PyUnicode_AsWideChar() call in
ctypes' U_set(). ctypes' U_set().
......
...@@ -4816,9 +4816,10 @@ load_binget(UnpicklerObject *self) ...@@ -4816,9 +4816,10 @@ load_binget(UnpicklerObject *self)
value = _Unpickler_MemoGet(self, idx); value = _Unpickler_MemoGet(self, idx);
if (value == NULL) { if (value == NULL) {
PyObject *key = PyLong_FromSsize_t(idx); PyObject *key = PyLong_FromSsize_t(idx);
if (!PyErr_Occurred()) if (key != NULL) {
PyErr_SetObject(PyExc_KeyError, key); PyErr_SetObject(PyExc_KeyError, key);
Py_DECREF(key); Py_DECREF(key);
}
return -1; return -1;
} }
...@@ -4841,9 +4842,10 @@ load_long_binget(UnpicklerObject *self) ...@@ -4841,9 +4842,10 @@ load_long_binget(UnpicklerObject *self)
value = _Unpickler_MemoGet(self, idx); value = _Unpickler_MemoGet(self, idx);
if (value == NULL) { if (value == NULL) {
PyObject *key = PyLong_FromSsize_t(idx); PyObject *key = PyLong_FromSsize_t(idx);
if (!PyErr_Occurred()) if (key != NULL) {
PyErr_SetObject(PyExc_KeyError, key); PyErr_SetObject(PyExc_KeyError, key);
Py_DECREF(key); Py_DECREF(key);
}
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment