ruby-changes:61465
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Wed, 3 Jun 2020 16:14:14 +0900 (JST)
Subject: [ruby-changes:61465] b61e82eac9 (master): vm_call_symbol: check stack overflow
https://git.ruby-lang.org/ruby.git/commit/?id=b61e82eac9 From b61e82eac9fb5ac247b204dd4fbf09ac49fce530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> 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. diff --git a/vm_insnhelper.c b/vm_insnhelper.c index e36ce10..bd6b0a2 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2708,6 +2708,7 @@ vm_call_symbol( https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2708 * --+------+--------+------+------ */ 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 v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/