]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #19437: Fix PyImport_ImportModuleLevelObject(), handle
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 13 Nov 2013 11:11:36 +0000 (12:11 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 13 Nov 2013 11:11:36 +0000 (12:11 +0100)
PyUnicode_Substring() failure (ex: MemoryError)

Python/import.c

index c96106f373265b44282c06e0dbc45ed3a6bd2e5b..ad181a2942a3b94bb169584c9ea6d111749befda 100644 (file)
@@ -1364,7 +1364,11 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
                 goto error;
             }
         }
+
         base = PyUnicode_Substring(package, 0, last_dot);
+        if (base == NULL)
+            goto error;
+
         if (PyUnicode_GET_LENGTH(name) > 0) {
             PyObject *borrowed_dot, *seq = NULL;