diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-05-31 16:44:42 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-03 16:13:47 +0900 |
commit | b61e82eac9fb5ac247b204dd4fbf09ac49fce530 (patch) | |
tree | fc04c10865a62d3e88c359ee897c9cc1282b6aa2 /vm_insnhelper.c | |
parent | ba20e6080d06e06b2e3a1098656021b2ae8df867 (diff) | |
download | ruby-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.c | 1 |
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; |