summaryrefslogtreecommitdiff
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorBill Fisher <william.w.fisher@gmail.com>2022-12-23 07:45:53 -0700
committerGitHub <noreply@github.com>2022-12-23 20:15:53 +0530
commit88d565f32a709140664444c6dea20ecd35a10e94 (patch)
treebd185455ee0b70ed60f6ca29479f2fb918999599 /Objects/frameobject.c
parent2659036c757a11235c4abd21f02c3a548a344fe7 (diff)
downloadcpython-git-88d565f32a709140664444c6dea20ecd35a10e94.tar.gz
gh-99110: Initialize `frame->previous` in init_frame to fix segmentation fault when accessing `frame.f_back` (#100182)
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 74c26d8d4d..eab85c08fc 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -1013,6 +1013,7 @@ init_frame(_PyInterpreterFrame *frame, PyFunctionObject *func, PyObject *locals)
PyCodeObject *code = (PyCodeObject *)func->func_code;
_PyFrame_InitializeSpecials(frame, (PyFunctionObject*)Py_NewRef(func),
Py_XNewRef(locals), code);
+ frame->previous = NULL;
for (Py_ssize_t i = 0; i < code->co_nlocalsplus; i++) {
frame->localsplus[i] = NULL;
}