]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
zipimport: catch _PyUnicode_AsString() failure in get_code_from_data()
authorVictor Stinner <victor.stinner@haypocalc.com>
Sat, 16 Oct 2010 11:29:07 +0000 (11:29 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sat, 16 Oct 2010 11:29:07 +0000 (11:29 +0000)
It occurs if the path contains surrogates.

Modules/zipimport.c

index d1c939f984f5d185658196cd81da24704c0993d2..efe69721ddbc27dab9230116b6de3e1e7a1bae5c 100644 (file)
@@ -1119,6 +1119,10 @@ get_code_from_data(ZipImporter *self, int ispackage, int isbytecode,
         return NULL;
 
     modpath = _PyUnicode_AsString(PyTuple_GetItem(toc_entry, 0));
+    if (modpath == NULL) {
+        Py_DECREF(data);
+        return NULL;
+    }
 
     if (isbytecode) {
         code = unmarshal_code(modpath, data, mtime);