summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-16 11:29:07 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-16 11:29:07 (GMT)
commit5a7913eb3bf390a2f3fd28116fc789bf2c7e4b64 (patch)
tree3cfc1d6d0bff4130721955e91865d41a5770352a /Modules
parent2c2bfe5bdf63bf5f85131ff7a773e28c094b9550 (diff)
downloadcpython-5a7913eb3bf390a2f3fd28116fc789bf2c7e4b64.zip
cpython-5a7913eb3bf390a2f3fd28116fc789bf2c7e4b64.tar.gz
cpython-5a7913eb3bf390a2f3fd28116fc789bf2c7e4b64.tar.bz2
zipimport: catch _PyUnicode_AsString() failure in get_code_from_data()
It occurs if the path contains surrogates.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/zipimport.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index d1c939f..efe6972 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);