From: Christian Heimes Date: Thu, 8 Sep 2016 22:25:03 +0000 (+0200) Subject: Fix potential NULL pointer dereference in _imp_create_builtin X-Git-Tag: v3.6.0b1~231 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a78b627e2b8ee464ecba3788725872d63f8a6b34;p=thirdparty%2FPython%2Fcpython.git Fix potential NULL pointer dereference in _imp_create_builtin PyModule_GetDef() can return NULL. Let's check the return value properly like in the other five cases. CID 1299590 --- diff --git a/Python/import.c b/Python/import.c index 17188c275a7e..dfdd9409e5e1 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1077,6 +1077,10 @@ _imp_create_builtin(PyObject *module, PyObject *spec) } else { /* Remember pointer to module init function. */ def = PyModule_GetDef(mod); + if (def == NULL) { + Py_DECREF(name); + return NULL; + } def->m_base.m_init = p->initfunc; if (_PyImport_FixupExtensionObject(mod, name, name) < 0) { Py_DECREF(name);