(original) (raw)
changeset: 86718:7f4a976829f1 user: Victor Stinner victor.stinner@gmail.com date: Tue Oct 29 01:46:24 2013 +0100 files: Modules/zipimport.c description: Issue #18408: Fix zipimport, handle PyUnicode_Substring() and get_subname() failures diff -r 11958c69a4b2 -r 7f4a976829f1 Modules/zipimport.c --- a/Modules/zipimport.c Tue Oct 29 01:43:44 2013 +0100 +++ b/Modules/zipimport.c Tue Oct 29 01:46:24 2013 +0100 @@ -117,6 +117,8 @@ if (flen == -1) break; filename = PyUnicode_Substring(path, 0, flen); + if (filename == NULL) + goto error; } if (filename == NULL) { PyErr_SetString(ZipImportError, "not a Zip file"); @@ -469,10 +471,13 @@ if (ispackage) { /* add __path__ to the module *before* the code gets executed */ - PyObject *pkgpath, *fullpath; - PyObject *subname = get_subname(fullname); + PyObject *pkgpath, *fullpath, *subname; int err; + subname = get_subname(fullname); + if (subname == NULL) + goto error; + fullpath = PyUnicode_FromFormat("%U%c%U%U", self->archive, SEP, self->prefix, subname); /victor.stinner@gmail.com