mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Rewind execution tags more at stack overflow [Bug #18084]
This commit is contained in:
parent
58bd943436
commit
574f3af36e
Notes:
git
2021-08-18 18:18:53 +09:00
1 changed files with 3 additions and 2 deletions
5
signal.c
5
signal.c
|
@ -878,12 +878,13 @@ check_stack_overflow(int sig, const uintptr_t addr, const ucontext_t *ctx)
|
|||
(sp_page <= fault_page && fault_page <= bp_page)) {
|
||||
rb_execution_context_t *ec = GET_EC();
|
||||
int crit = FALSE;
|
||||
if ((uintptr_t)ec->tag->buf / pagesize <= fault_page + 1) {
|
||||
int uplevel = roomof(pagesize, sizeof(*ec->tag)) / 2; /* XXX: heuristic */
|
||||
while ((uintptr_t)ec->tag->buf / pagesize <= fault_page + 1) {
|
||||
/* drop the last tag if it is close to the fault,
|
||||
* otherwise it can cause stack overflow again at the same
|
||||
* place. */
|
||||
if ((crit = (!ec->tag->prev || !--uplevel)) != FALSE) break;
|
||||
ec->tag = ec->tag->prev;
|
||||
crit = TRUE;
|
||||
}
|
||||
reset_sigmask(sig);
|
||||
rb_ec_stack_overflow(ec, crit);
|
||||
|
|
Loading…
Add table
Reference in a new issue