]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-151763: Fix NULL dereference in `os._path_normpath()` under OOM (GH-151779...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 24 Jun 2026 16:22:23 +0000 (18:22 +0200)
committerGitHub <noreply@github.com>
Wed, 24 Jun 2026 16:22:23 +0000 (16:22 +0000)
(cherry picked from commit ce8b81fff4094bd0cfb0c57193135bfc904c0ca2)

Co-authored-by: Zain Nadeem <zainnadeemzainnadeem80@gmail.com>
Modules/posixmodule.c

index 3fcf19e63c19aef3aaceced0f3ffc00904ba2ce1..a633c5f869376f507be59c6e2c6f7b787289ecf4 100644 (file)
@@ -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));
     }