Crates.io | slotmap-careful |
lib.rs | slotmap-careful |
version | |
source | src |
created_at | 2024-09-03 19:13:42.346255 |
updated_at | 2025-01-07 17:17:45.704059 |
description | Wrap the slotmap crate and prevent key reuse |
homepage | https://gitlab.torproject.org/tpo/core/arti/-/wikis/home |
repository | https://gitlab.torproject.org/tpo/core/arti.git/ |
max_upload_size | |
id | 1361951 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
The [slotmap
] generational arena implementation is efficient and easy to use.
Unfortunately, it has a behavior where if a single index slot is reused
about 2^31 times, its version field will wrap around, and the same key will be returned twice.
This can lead to security problems in programs that rely on each for a slotmap
being permanently unique.
This crate implement a wrapper around [slotmap::SlotMap
] to prevent key reuse.
It works by noticing when any slot with a very high version counter is about to become empty,
and instead marking such slots as permanently unusable.
Note that this new behavior can result in memory usage that grows slowly over time, even if the actual capacity of the slotmap remains low.