From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 24 Jun 2026 16:23:16 +0000 (+0200) Subject: [3.14] gh-151763: Fix NULL dereference in `os._path_normpath()` under OOM (GH-151779... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45de3e041968ffb4aa84a67ccd1502099dad7f2f;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-151763: Fix NULL dereference in `os._path_normpath()` under OOM (GH-151779) (#152095) (cherry picked from commit ce8b81fff4094bd0cfb0c57193135bfc904c0ca2) Co-authored-by: Zain Nadeem --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 4ead98f49ac7..b7aa5781f8cc 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5684,6 +5684,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)); }