From b61e82eac9fb5ac247b204dd4fbf09ac49fce530 Mon Sep 17 00:00:00 2001 From: 卜部昌平 Date: Sun, 31 May 2020 16:44:42 +0900 Subject: vm_call_symbol: check stack overflow VM stack could overflow here. The condition is when a symbol is passed to a block-taking method via &variable, and that symbol has never been used for actual method names (thus yielding that results in calling method_missing), and the VM stack is full (no single word left). This is a once-in-a-blue-moon event. Yet there is a very tiny room of stack overflow. We need to check that. --- vm_insnhelper.c | 1 + 1 file changed, 1 insertion(+) (limited to 'vm_insnhelper.c') diff --git a/vm_insnhelper.c b/vm_insnhelper.c index e36ce10237..bd6b0a2c01 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2708,6 +2708,7 @@ vm_call_symbol( * --+------+--------+------+------ */ int i = argc; + CHECK_VM_STACK_OVERFLOW(reg_cfp, 1); INC_SP(1); MEMMOVE(&TOPN(i - 1), &TOPN(i), VALUE, i); argc = ++calling->argc; -- cgit v1.2.3