You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, we (Rust group @sslab-gatech) are scanning crates on crates.io for potential soundness bugs. We noticed a few panic safety issues in this library.
The current values in the map are dropped and the ids are updated up front. This means that if other.values.get_unchecked(id).clone() panics, it can cause the previously dropped values to drop again.
get_or_insert double frees if insertion function f panics
This code goes over to the ids to remove and calls drop_in_place on them. However if the drop function for the type panics, the element gets dropped again when the IdMap is dropped.
Once a fix is released to crates.io, please open a pull request to update the advisory with the patched version, or file an issue on the advisory database repository.
Hi there, we (Rust group @sslab-gatech) are scanning crates on crates.io for potential soundness bugs. We noticed a few panic safety issues in this library.
clone_from double-frees if T::clone panics
id-map/src/lib.rs
Lines 370 to 380 in a2fa8d4
The current values in the map are dropped and the
ids
are updated up front. This means that ifother.values.get_unchecked(id).clone()
panics, it can cause the previously dropped values to drop again.get_or_insert double frees if insertion function f panics
id-map/src/lib.rs
Lines 169 to 180 in a2fa8d4
Since this reserves space for the value before calling
ptr::write(space, f());
, iff
panics here, it can drop an already freed value.remove_set double frees if drop panics
id-map/src/lib.rs
Lines 192 to 203 in a2fa8d4
This code goes over to the ids to remove and calls
drop_in_place
on them. However if the drop function for the type panics, the element gets dropped again when theIdMap
is dropped.Code to recrate these problems is here:
The text was updated successfully, but these errors were encountered: