diff options
author | nagachika <nagachika@ruby-lang.org> | 2021-02-11 12:31:21 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-02-11 12:31:21 +0900 |
commit | 29bc77f780bbefca60724e52129f5229aa373551 (patch) | |
tree | 80988d0affdb2c5a2945e301edcee02f52ce5f4c /cont.c | |
parent | 7332b3f367ce61089bf571fa1c458fde06a11eab (diff) |
merge revision(s) 9fb60672d55162a92ab7e97b000a7e277458aab1: [Backport #17313]
Fix a use-after-free bug reported by ASAN
If a fiber and thread are collected at the same time, the thread might
get collected first and the pointer on the fiber will go bad. I don't
think we need to check whether or not this is the main fiber in order to
release its stack
---
cont.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -919,9 +919,7 @@ cont_free(void *ptr) else { rb_fiber_t *fiber = (rb_fiber_t*)cont; coroutine_destroy(&fiber->context); - if (!fiber_is_root_p(fiber)) { - fiber_stack_release(fiber); - } + fiber_stack_release(fiber); } RUBY_FREE_UNLESS_NULL(cont->saved_vm_stack.ptr); |