https://github.com/python/cpython/commit/ce8b81fff4094bd0cfb0c57193135bfc904c0ca2
commit: ce8b81fff4094bd0cfb0c57193135bfc904c0ca2
branch: main
author: Zain Nadeem <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-06-24T16:56:10+01:00
summary:

gh-151763: Fix NULL dereference in `os._path_normpath()` under OOM (#151779)

files:
M Modules/posixmodule.c

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 1f1b7fa729c01c..c52d2e7d5bfbd9 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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));
     }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to