8000 gh-99110: Initialize frame->previous in init_frame to fix segmentation fault by byllyfish · Pull Request #100182 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-99110: Initialize frame->previous in init_frame to fix segmentation fault #100182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 23, 2022
Prev Previous commit
Next Next commit
Move comment above function.
  • Loading branch information
byllyfish committed Dec 18, 2022
commit 230b80e2c5a7da57283f219f94a879602edf29ed
6 changes: 4 additions & 2 deletions Include/internal/pycore_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ static inline void _PyFrame_StackPush(_PyInterpreterFrame *f, PyObject *value) {

void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest);

/* Consumes reference to func and locals */
/* Consumes reference to func and locals.
Does not initialize frame->previous, which happens
when frame is linked into the frame stack.
*/
static inline void
_PyFrame_InitializeSpecials(
_PyInterpreterFrame *frame, PyFunctionObject *func,
Expand All @@ -112,7 +115,6 @@ _PyFrame_InitializeSpecials(
frame->prev_instr = _PyCode_CODE(code) - 1;
frame->yield_offset = 0;
frame->owner = FRAME_OWNED_BY_THREAD;
// frame->previous: initialized when frame is linked into the frame stack
}

/* Gets the pointer to the locals array
Expand Down
0