mirror of https://github.com/python/cpython
Additional safe-guard against dereferencing NULL in reduce_newobj
_PyObject_GetNewArguments() can leave args == NULL but the __newobj_ex__ branch expects args to be not-NULL. CID 1353201
This commit is contained in:
parent
884332b45a
commit
07a2a1b7e5
|
@ -4263,7 +4263,7 @@ reduce_newobj(PyObject *obj)
|
||||||
}
|
}
|
||||||
Py_XDECREF(args);
|
Py_XDECREF(args);
|
||||||
}
|
}
|
||||||
else {
|
else if (args != NULL) {
|
||||||
_Py_IDENTIFIER(__newobj_ex__);
|
_Py_IDENTIFIER(__newobj_ex__);
|
||||||
|
|
||||||
newobj = _PyObject_GetAttrId(copyreg, &PyId___newobj_ex__);
|
newobj = _PyObject_GetAttrId(copyreg, &PyId___newobj_ex__);
|
||||||
|
@ -4281,6 +4281,12 @@ reduce_newobj(PyObject *obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* args == NULL */
|
||||||
|
Py_DECREF(kwargs);
|
||||||
|
PyErr_BadInternalCall();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
state = _PyObject_GetState(obj,
|
state = _PyObject_GetState(obj,
|
||||||
!hasargs && !PyList_Check(obj) && !PyDict_Check(obj));
|
!hasargs && !PyList_Check(obj) && !PyDict_Check(obj));
|
||||||
|
|
Loading…
Reference in New Issue