Issue #28715: Added error checks for PyUnicode_AsUTF8().

This commit is contained in:
Serhiy Storchaka 2016-11-20 08:48:07 +02:00
commit e20973926a
5 changed files with 20 additions and 10 deletions

View file

@ -147,6 +147,10 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
/* Package context is needed for single-phase init */
oldcontext = _Py_PackageContext;
_Py_PackageContext = PyUnicode_AsUTF8(name_unicode);
if (_Py_PackageContext == NULL) {
_Py_PackageContext = oldcontext;
goto error;
}
m = p0();
_Py_PackageContext = oldcontext;