From 88d565f32a709140664444c6dea20ecd35a10e94 Mon Sep 17 00:00:00 2001 From: Bill Fisher Date: Fri, 23 Dec 2022 07:45:53 -0700 Subject: gh-99110: Initialize `frame->previous` in init_frame to fix segmentation fault when accessing `frame.f_back` (#100182) --- Objects/frameobject.c | 1 + 1 file changed, 1 insertion(+) (limited to 'Objects/frameobject.c') 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; } -- cgit v1.2.1