summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-06-16 10:23:11 -0700
committerJeremy Evans <code@jeremyevans.net>2021-07-27 10:47:53 -0700
commita6dc48f86a8ee7b1f713105b5c7136824d6b5720 (patch)
treeab6b8fec1d72e9b285aaea8019c30e896cc27f18 /vm.c
parent230111802c2b9dcb8f391b489ff52a9dc0b41b87 (diff)
Fix infinite loop in ensure after NoMemoryError
VM patch from wanabe. Test based on example from buzztaiki (Taiki Sugawara). Test fails when compiles with -DRUBY_DEBUG, as that can can use rb_bug instead of NoMemoryError, which doesn't allow testing this case. Test also fails on MingW, as RangeError is used instead of NoMemoryError. Skip the test in either case. Fixes [Bug #15779]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4577
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 75cd371c97..4e458b344d 100644
--- a/vm.c
+++ b/vm.c
@@ -2168,7 +2168,7 @@ vm_exec(rb_execution_context_t *ec, bool mjit_enable_p)
}
else {
result = ec->errinfo;
- rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW);
+ rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW | RAISED_NOMEMORY);
while ((result = vm_exec_handle_exception(ec, state, result, &initial)) == Qundef) {
/* caught a jump, exec the handler */
result = vm_exec_core(ec, initial);