зеркало из https://github.com/github/ruby.git
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:
Родитель
2db081b5ff
Коммит
9fb60672d5
4
cont.c
4
cont.c
|
@ -940,9 +940,7 @@ cont_free(void *ptr)
|
||||||
else {
|
else {
|
||||||
rb_fiber_t *fiber = (rb_fiber_t*)cont;
|
rb_fiber_t *fiber = (rb_fiber_t*)cont;
|
||||||
coroutine_destroy(&fiber->context);
|
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);
|
RUBY_FREE_UNLESS_NULL(cont->saved_vm_stack.ptr);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче