summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2025-03-13 13:26:38 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-03-13 14:27:06 +0900
commitf89a334b555d9f91f0bb5a7c58b3097960dd7fb8 (patch)
tree56d82266863cb679e57820bc5986bfdd71ab5743 /ruby.c
parent2c4951329122143b5e0375caf1d4481173e403cb (diff)
merge revision(s) bccec7fb468ad977be75e7e4c2644b4ea845ab0c, 5f8ebcada099351acbc22db264e7cd3773c2bdc4, e13575bb7938e9e5b6a79bfca1b3793123f479da, 4adcfc8cd7a17593a6590025da2b03eebf4fd63c: [Backport #19584]
Fix crash in rb_gc_register_address [Bug #19584] Some C extensions pass a pointer to a global variable to rb_gc_register_address. However, if a GC is triggered inside of rb_gc_register_address, then the object could get swept since it does not exist on the stack. [Bug #19584] Register global variable address before assignment [Bug #19584] Register global variables before assignment [Bug #19584] [DOC] Tweek description of `rb_gc_register_address`
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ruby.c b/ruby.c
index 920a2490d2..09c81db86c 100644
--- a/ruby.c
+++ b/ruby.c
@@ -647,8 +647,8 @@ ruby_init_loadpath(void)
# endif
rb_obj_hide(selfpath);
OBJ_FREEZE_RAW(selfpath);
- rb_libruby_selfpath = selfpath;
rb_gc_register_address(&rb_libruby_selfpath);
+ rb_libruby_selfpath = selfpath;
# endif
#endif