Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle empty code objects, and other invalid code, gracefully.
  • Loading branch information
markshannon committed Jun 13, 2022
commit ea8bea24bf8699767c0736b029a8ee303060f9dc
3 changes: 2 additions & 1 deletion Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
memcpy(_PyCode_CODE(co), PyBytes_AS_STRING(con->code),
PyBytes_GET_SIZE(con->code));
int entry_point = 0;
while (_Py_OPCODE(_PyCode_CODE(co)[entry_point]) != RESUME) {
while (_Py_OPCODE(_PyCode_CODE(co)[entry_point]) != RESUME &&
Comment thread
markshannon marked this conversation as resolved.
Outdated
entry_point < Py_SIZE(co)) {
entry_point++;
}
co->_co_firsttraceable = entry_point;
Expand Down