From 144f77a981ecad8884e1a4e70db72e6fdb609103 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 20 Nov 2016 08:47:21 +0200 Subject: Issue #28715: Added error checks for PyUnicode_AsUTF8(). --- Python/importdl.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Python/importdl.c') diff --git a/Python/importdl.c b/Python/importdl.c index 1aa585d5e8..ea4f0e7cee 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -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; -- cgit v1.2.1