From: Victor Stinner Date: Sat, 16 Oct 2010 11:29:07 +0000 (+0000) Subject: zipimport: catch _PyUnicode_AsString() failure in get_code_from_data() X-Git-Tag: v3.2a4~531 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a7913eb3bf390a2f3fd28116fc789bf2c7e4b64;p=thirdparty%2FPython%2Fcpython.git zipimport: catch _PyUnicode_AsString() failure in get_code_from_data() It occurs if the path contains surrogates. --- diff --git a/Modules/zipimport.c b/Modules/zipimport.c index d1c939f984f5..efe69721ddbc 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -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);