diff options
author | Matt Valentine-House <[email protected]> | 2024-12-18 22:10:04 +0000 |
---|---|---|
committer | Matt Valentine-House <[email protected]> | 2024-12-20 07:49:30 +0000 |
commit | 2f6c694977dc0cdc4766a8a921e74290963c19a7 (patch) | |
tree | 1bdc316d67dcb2333ce49cdf222984f34779b178 /gc.c | |
parent | 978df259ca90c25ca2acb95a099ff6d3ff0161b0 (diff) |
Memerror is fatal if VM cannot be unlocked.
[Bug #20942]
If we've raised a memerror while the VM is locked, and the tag we're
jumping to has been locked at a different level to the current lock (ie.
we've locked the VM again since the tag we're jumping to) then we should
consider this memerror fatal and exit, since the tag cannot unlock the
VM.
Co-Authored-By: Peter Zhu <[email protected]>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12393
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -4481,7 +4481,8 @@ rb_memerror(void) VALUE exc = GET_VM()->special_exceptions[ruby_error_nomemory]; if (!exc || - rb_ec_raised_p(ec, RAISED_NOMEMORY)) { + rb_ec_raised_p(ec, RAISED_NOMEMORY) || + rb_ec_vm_lock_rec(ec) != ec->tag->lock_rec) { fprintf(stderr, "[FATAL] failed to allocate memory\n"); exit(EXIT_FAILURE); } |