mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
fix UAFs in register_lazy_on_parent
This commit is contained in:
parent
2a514d92a9
commit
74f35c42cb
1 changed files with 3 additions and 6 deletions
|
|
@ -4283,8 +4283,7 @@ register_lazy_on_parent(PyThreadState *tstate, PyObject *name, PyObject *builtin
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the lazy import for the child to the parent */
|
/* Add the lazy import for the child to the parent */
|
||||||
Py_XDECREF(parent_module);
|
Py_XSETREF(parent_module, PyImport_GetModule(parent));
|
||||||
parent_module = PyImport_GetModule(parent);
|
|
||||||
if (parent_module == NULL) {
|
if (parent_module == NULL) {
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -4310,8 +4309,7 @@ register_lazy_on_parent(PyThreadState *tstate, PyObject *name, PyObject *builtin
|
||||||
}
|
}
|
||||||
Py_DECREF(lazy_submodules);
|
Py_DECREF(lazy_submodules);
|
||||||
} else {
|
} else {
|
||||||
Py_XDECREF(parent_dict);
|
Py_XSETREF(parent_dict, get_mod_dict(parent_module));
|
||||||
parent_dict = get_mod_dict(parent_module);
|
|
||||||
if (parent_dict == NULL) {
|
if (parent_dict == NULL) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
@ -4334,8 +4332,7 @@ register_lazy_on_parent(PyThreadState *tstate, PyObject *name, PyObject *builtin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_DECREF(name);
|
Py_SETREF(name, parent);
|
||||||
name = parent;
|
|
||||||
parent = NULL;
|
parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue