1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) 9fb60672d5: [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(-)
This commit is contained in:
nagachika 2021-02-11 12:31:21 +09:00
parent 7332b3f367
commit 29bc77f780
2 changed files with 4 additions and 6 deletions

4
cont.c
View file

@ -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);

View file

@ -2,11 +2,11 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 3
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
#define RUBY_PATCHLEVEL 148
#define RUBY_PATCHLEVEL 149
#define RUBY_RELEASE_YEAR 2021
#define RUBY_RELEASE_MONTH 1
#define RUBY_RELEASE_DAY 30
#define RUBY_RELEASE_MONTH 2
#define RUBY_RELEASE_DAY 11
#include "ruby/version.h"