Skip to content

Commit 45de3e0

Browse files
[3.14] gh-151763: Fix NULL dereference in os._path_normpath() under OOM (GH-151779) (#152095)
(cherry picked from commit ce8b81f) Co-authored-by: Zain Nadeem <zainnadeemzainnadeem80@gmail.com>
1 parent e1323cd commit 45de3e0

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
@@ -5684,6 +5684,9 @@ os__path_normpath_impl(PyObject *module, path_t *path)
56845684
else {
56855685
result = PyUnicode_FromWideChar(norm_path, norm_len);
56865686
}
5687+
if (result == NULL) {
5688+
return NULL;
5689+
}
56875690
if (PyBytes_Check(path->object)) {
56885691
Py_SETREF(result, PyUnicode_EncodeFSDefault(result));
56895692
}

0 commit comments

Comments
 (0)