From: Andrew M. Kuchling Date: Tue, 3 Oct 2006 19:08:48 +0000 (+0000) Subject: [Backport r51231 | neal.norwitz] X-Git-Tag: v2.4.4c1~65 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=fec767442089180f5642c4f57261b6f3a05dcc35;p=thirdparty%2FPython%2Fcpython.git [Backport r51231 | neal.norwitz] PyModule_GetDict() can fail, produce fatal errors if this happens on startup. Klocwork #298-299. --- diff --git a/Python/pythonrun.c b/Python/pythonrun.c index e093dc52981a..9ef1fea41f69 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -185,12 +185,16 @@ Py_InitializeEx(int install_sigs) if (bimod == NULL) Py_FatalError("Py_Initialize: can't initialize __builtin__"); interp->builtins = PyModule_GetDict(bimod); + if (interp->builtins == NULL) + Py_FatalError("Py_Initialize: can't initialize builtins dict"); Py_INCREF(interp->builtins); sysmod = _PySys_Init(); if (sysmod == NULL) Py_FatalError("Py_Initialize: can't initialize sys"); interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + Py_FatalError("Py_Initialize: can't initialize sys dict"); Py_INCREF(interp->sysdict); _PyImport_FixupExtension("sys", "sys"); PySys_SetPath(Py_GetPath());