diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-12-16 10:49:49 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2024-12-17 11:03:38 -0500 |
| commit | 9733304d6112ca3ac81b70dfecf7b2b7f63beff5 (patch) | |
| tree | 41d9f57bb8bcc6f032e46de75ecf86a51aef1540 | |
| parent | 50a67820fbbb9347b3d659502bca80b0b921eeb2 (diff) | |
Assert Ruby object in rb_gc_location
rb_gc_location doesn't check that the object is actually a Ruby object
and only checks if the object looks like a T_MOVED. This may have unexpected
outcomes if the object is not a Ruby object (e.g. a piece of malloc memory
may be corrupted).
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12371
| -rw-r--r-- | gc.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -2427,6 +2427,8 @@ gc_location_internal(void *objspace, VALUE value) return value; } + GC_ASSERT(rb_gc_impl_pointer_to_heap_p(objspace, (void *)value)); + return rb_gc_impl_location(objspace, value); } |
