kyren / gc-arena

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

Fix unsoundness in Hash{Map, Set}'s Collect implementation #34

Closed moulins closed 1 year ago

moulins commented 1 year ago

These implementations accept arbitrary S: BuildHasher, but don't trace the value at all.

This adds an extra S: 'static bound to prevent smuggling Gc pointers through the hasher. (All 'real' hashers are 'static, so this is better than adding a Collect bound w.r.t. third-party hashers support)

kyren commented 1 year ago

Ahhhh good catch!