kyren / gc-arena

Incremental garbage collection from safe Rust
Creative Commons Zero v1.0 Universal
502 stars 41 forks source link

Fix unsound address computation in `erased_value` #37

Closed Aaron1011 closed 1 year ago

Aaron1011 commented 1 year ago

We need to use the type *mut GcBoxInner<T> when computing a pointer to the value field, since the field location depends on the alignment of T. Using *mut GcBoxInner<()> will happen to work correctly when the original value field didn't require any padding, but will break when the alignment of T causes padding to be inserted into GcBoxInner<T>.