aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-05-31 16:44:42 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-03 16:13:47 +0900
commitb61e82eac9fb5ac247b204dd4fbf09ac49fce530 (patch)
treefc04c10865a62d3e88c359ee897c9cc1282b6aa2 /vm_insnhelper.c
parentba20e6080d06e06b2e3a1098656021b2ae8df867 (diff)
downloadruby-b61e82eac9fb5ac247b204dd4fbf09ac49fce530.tar.gz
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.
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c1
1 files changed, 1 insertions, 0 deletions
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;