mirror of
https://github.com/python/cpython.git
synced 2026-06-29 04:10:54 +00:00
[3.15] gh-151763: Fix NULL dereference in os._path_normpath() under OOM (GH-151779) (#152096)
(cherry picked from commit ce8b81fff4)
Co-authored-by: Zain Nadeem <zainnadeemzainnadeem80@gmail.com>
This commit is contained in:
parent
d4836f4d99
commit
4e7843ea3e
1 changed files with 3 additions and 0 deletions
|
|
@ -6145,6 +6145,9 @@ os__path_normpath_impl(PyObject *module, path_t *path)
|
|||
else {
|
||||
result = PyUnicode_FromWideChar(norm_path, norm_len);
|
||||
}
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (PyBytes_Check(path->object)) {
|
||||
Py_SETREF(result, PyUnicode_EncodeFSDefault(result));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue