Skip to content
4 changes: 4 additions & 0 deletions Python/instrumentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,10 @@ _Py_call_instrumentation_jump(
event == PY_MONITORING_EVENT_BRANCH_RIGHT ||
event == PY_MONITORING_EVENT_BRANCH_LEFT);
int to = (int)(dest - _PyFrame_GetBytecode(frame));
if (to <= INT_MAX / (int)sizeof(_Py_CODEUNIT)) {
PyErr_SetString(PyExc_OverflowError, "instruction offset cannot be converted to an integer");
return NULL;
}
PyObject *to_obj = PyLong_FromLong(to * (int)sizeof(_Py_CODEUNIT));
if (to_obj == NULL) {
return NULL;
Expand Down
Loading