mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
GH-141861: Fix invalid memory read in the ENTER_EXECUTOR (GH-141921)
This commit is contained in:
parent
369ce2b139
commit
dc62b62252
4 changed files with 35 additions and 2 deletions
|
|
@ -2662,6 +2662,38 @@ def f():
|
|||
f" {executor} at offset {idx} rather"
|
||||
f" than expected _EXIT_TRACE")
|
||||
|
||||
def test_enter_executor_valid_op_arg(self):
|
||||
script_helper.assert_python_ok("-c", textwrap.dedent("""
|
||||
import sys
|
||||
sys.setrecursionlimit(30) # reduce time of the run
|
||||
|
||||
str_v1 = ''
|
||||
tuple_v2 = (None, None, None, None, None)
|
||||
small_int_v3 = 4
|
||||
|
||||
def f1():
|
||||
|
||||
for _ in range(10):
|
||||
abs(0)
|
||||
|
||||
tuple_v2[small_int_v3]
|
||||
tuple_v2[small_int_v3]
|
||||
tuple_v2[small_int_v3]
|
||||
|
||||
def recursive_wrapper_4569():
|
||||
str_v1 > str_v1
|
||||
str_v1 > str_v1
|
||||
str_v1 > str_v1
|
||||
recursive_wrapper_4569()
|
||||
|
||||
recursive_wrapper_4569()
|
||||
|
||||
for i_f1 in range(19000):
|
||||
try:
|
||||
f1()
|
||||
except RecursionError:
|
||||
pass
|
||||
"""))
|
||||
|
||||
|
||||
def global_identity(x):
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Fix invalid memory read in the ``ENTER_EXECUTOR`` instruction.
|
||||
|
|
@ -3018,7 +3018,7 @@ dummy_func(
|
|||
goto stop_tracing;
|
||||
}
|
||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
|
||||
_PyExecutorObject *executor = code->co_executors->executors[this_instr->op.arg];
|
||||
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
|
||||
assert(executor->vm_data.code == code);
|
||||
assert(executor->vm_data.valid);
|
||||
|
|
|
|||
2
Python/generated_cases.c.h
generated
2
Python/generated_cases.c.h
generated
|
|
@ -5476,7 +5476,7 @@
|
|||
JUMP_TO_LABEL(stop_tracing);
|
||||
}
|
||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
|
||||
_PyExecutorObject *executor = code->co_executors->executors[this_instr->op.arg];
|
||||
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
|
||||
assert(executor->vm_data.code == code);
|
||||
assert(executor->vm_data.valid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue