mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
In PyFrame_New(), don't set extras to something derived from code
before code has been checked for validity. Discovered by Vladimir Marangozov.
This commit is contained in:
parent
d35c255e44
commit
67906af811
1 changed files with 2 additions and 1 deletions
|
@ -150,7 +150,7 @@ PyFrame_New(tstate, code, globals, locals)
|
||||||
static PyObject *builtin_object;
|
static PyObject *builtin_object;
|
||||||
PyFrameObject *f;
|
PyFrameObject *f;
|
||||||
PyObject *builtins;
|
PyObject *builtins;
|
||||||
int extras = code->co_stacksize + code->co_nlocals;
|
int extras;
|
||||||
|
|
||||||
if (builtin_object == NULL) {
|
if (builtin_object == NULL) {
|
||||||
builtin_object = PyString_InternFromString("__builtins__");
|
builtin_object = PyString_InternFromString("__builtins__");
|
||||||
|
@ -164,6 +164,7 @@ PyFrame_New(tstate, code, globals, locals)
|
||||||
PyErr_BadInternalCall();
|
PyErr_BadInternalCall();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
extras = code->co_stacksize + code->co_nlocals;
|
||||||
if (back == NULL || back->f_globals != globals) {
|
if (back == NULL || back->f_globals != globals) {
|
||||||
builtins = PyDict_GetItem(globals, builtin_object);
|
builtins = PyDict_GetItem(globals, builtin_object);
|
||||||
if (builtins != NULL && PyModule_Check(builtins))
|
if (builtins != NULL && PyModule_Check(builtins))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue