diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-09-05 13:34:46 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-09-05 14:32:15 -0400 |
commit | 9a8398a18f364d3bcfc8d2744162d3572d9491e4 (patch) | |
tree | 4d9202dffe750a9c9377f18755e33d3556ab3246 /internal | |
parent | 06a1d16dc2108c54090a0fca8b356f39ef353a99 (diff) |
Introduce rb_gc_remove_weak
If we're during incremental marking, then Ruby code can execute that
deallocates certain memory buffers that have been called with
rb_gc_mark_weak, which can cause use-after-free bugs.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8375
Diffstat (limited to 'internal')
-rw-r--r-- | internal/gc.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/gc.h b/internal/gc.h index be40a7a2f7..28b82f4196 100644 --- a/internal/gc.h +++ b/internal/gc.h @@ -236,6 +236,7 @@ VALUE rb_define_finalizer_no_check(VALUE obj, VALUE block); void rb_gc_mark_and_move(VALUE *ptr); void rb_gc_mark_weak(VALUE *ptr); +void rb_gc_remove_weak(VALUE parent_obj, VALUE *ptr); #define rb_gc_mark_and_move_ptr(ptr) do { \ VALUE _obj = (VALUE)*(ptr); \ |