mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #18559: Fix NULL pointer dereference error in _pickle module
This commit is contained in:
parent
66eda26a72
commit
9ee5c37c8f
2 changed files with 8 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue