mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
2db081b5ff
commit
9fb60672d5
Notes:
git
2020-10-02 00:43:27 +09:00
1 changed files with 1 additions and 3 deletions
4
cont.c
4
cont.c
|
@ -940,9 +940,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);
|
||||
|
|
Loading…
Add table
Reference in a new issue