Commit 5a7913eb authored by Victor Stinner's avatar Victor Stinner

zipimport: catch _PyUnicode_AsString() failure in get_code_from_data()

It occurs if the path contains surrogates.
parent 2c2bfe5b
...@@ -1119,6 +1119,10 @@ get_code_from_data(ZipImporter *self, int ispackage, int isbytecode, ...@@ -1119,6 +1119,10 @@ get_code_from_data(ZipImporter *self, int ispackage, int isbytecode,
return NULL; return NULL;
modpath = _PyUnicode_AsString(PyTuple_GetItem(toc_entry, 0)); modpath = _PyUnicode_AsString(PyTuple_GetItem(toc_entry, 0));
if (modpath == NULL) {
Py_DECREF(data);
return NULL;
}
if (isbytecode) { if (isbytecode) {
code = unmarshal_code(modpath, data, mtime); code = unmarshal_code(modpath, data, mtime);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment