Skip to content

Commit bd3482d

Browse files
zainnadeem786miss-islington
authored andcommitted
gh-151763: Fix NULL dereference in os._path_normpath() under OOM (GH-151779)
(cherry picked from commit ce8b81f) Co-authored-by: Zain Nadeem <zainnadeemzainnadeem80@gmail.com>
1 parent d4836f4 commit bd3482d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Modules/posixmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6145,6 +6145,9 @@ os__path_normpath_impl(PyObject *module, path_t *path)
61456145
else {
61466146
result = PyUnicode_FromWideChar(norm_path, norm_len);
61476147
}
6148+
if (result == NULL) {
6149+
return NULL;
6150+
}
61486151
if (PyBytes_Check(path->object)) {
61496152
Py_SETREF(result, PyUnicode_EncodeFSDefault(result));
61506153
}

0 commit comments

Comments
 (0)