From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 24 Jun 2026 16:22:23 +0000 (+0200) Subject: [3.13] 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=58476e8cbbe19fb60b5819d30d0020bd790fad30;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-151763: Fix NULL dereference in `os._path_normpath()` under OOM (GH-151779) (#152094) (cherry picked from commit ce8b81fff4094bd0cfb0c57193135bfc904c0ca2) Co-authored-by: Zain Nadeem --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 3fcf19e63c19..a633c5f86937 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5577,6 +5577,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)); }