CVE-2026-34941: Improper Entityset Capacity

Initializing a TryEntitySet (which uses direct array indexing based on the element's index value) with a capacity equal to the `.len()` of a sparse or filtered map may result in an insufficient capacity. `len()` represents the number of elements, but `TryEntitySet::with_capacity` expects a maximum possible index length. If the map doesn't contain all contigu

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Rust
greprules fetch cve-2026-34941-improper-entityset-capacity --engine opengrep

Description

Initializing a TryEntitySet (which uses direct array indexing based on the element's index value) with a capacity equal to the `.len()` of a sparse or filtered map may result in an insufficient capacity. `len()` represents the number of elements, but `TryEntitySet::with_capacity` expects a maximum possible index length. If the map doesn't contain all contigu