GHSA-qq4c-hm99-979m: Id map IdMap From_iter May Lead To Vulnerability

MODERATE
CWE-665
Published
Advisory Summary

GHSA-qq4c-hm99-979m is a MODERATE idmap from_iter may lead to vulnerability (CWE-665: Improper Initialization) affecting Id map libraries in the crates.io ecosystem. The issue involves idmap from_iter may lead to uninitialized memory being freed on drop. Remediation is available by upgrading affected packages to version 0.2.2.

GHSA-qq4c-hm99-979m at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-qq4c-hm99-979m
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-665: Improper Initialization
Affected Product Id map
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-qq4c-hm99-979m

To remediate this vulnerability, upgrade all affected Id map dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

id-map fixed: 0.2.2
Upgrade id-map to 0.2.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for id-map

How to Check if You Are Affected

To determine whether your application is affected by GHSA-qq4c-hm99-979m, inspect your project dependencies for Id map:

inspect dependencies for id-map

Analyze the terminal output to locate any version of Id map in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-665: Improper Initialization, where the product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used. In Id map, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Due to a flaw in the constructor `id_map::IdMap::from_iter`, ill-formed objects may be created in which the amount of actually initialized memory is less than what is expected by the fields of `IdMap`. Specifically, the field `ids` is initialized based on the capacity of the vector `values`, which is constructed from the provided iterator. However, the length of this vector may be smaller than its capacity. In such cases, when the resulting `IdMap` is dropped, its destructor incorrectly assumes that `values` contains `ids.len() == values.capacity()` initialized elements and attempts to iterate over and drop them. This leads to dereferencing and attempting to free uninitialized memory, resulting in undefined behavior and potential segmentation faults. The bug was fixed in commit `fab6922`, and all unsafe code was removed from the crate. Note that the maintainer recommends using the following alternatives: - [slab](https://crates.io/crates/slab) - [slotmap](https://crates.io/crates/slotmap)

GHSA-qq4c-hm99-979m Affected Id map Versions

1 component(s)
Fixed Versions:
0.2.2
Product / Package Ecosystem Affected Versions Fixed Version
id-map
crates.io
≥ 0.1.6
< 0.2.2
0.2.2

References

Frequently Asked Questions

What is GHSA-qq4c-hm99-979m?
GHSA-qq4c-hm99-979m is a security vulnerability in Id map involving IdMap from_iter may lead to uninitialized memory being freed on drop under CWE-665: Improper Initialization.
Which Id map versions are affected?
Affected versions include releases prior to 0.2.2 across affected packages: id-map.
What version fixes GHSA-qq4c-hm99-979m?
Upgrading to 0.2.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is id-map affected?
Yes, id-map is affected in releases prior to 0.2.2. Upgrade your dependency to 0.2.2 or later.
What CWE is associated with GHSA-qq4c-hm99-979m?
GHSA-qq4c-hm99-979m is classified under CWE-665: Improper Initialization (The product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used.).
How can I check crates.io dependencies for GHSA-qq4c-hm99-979m?
Run the dependency tree command: 'inspect dependencies for id-map'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qq4c-hm99-979m",
  "modified" : "2025-08-18T15:10:15Z",
  "published" : "2025-08-18T15:10:15Z",
  "aliases" : [ ],
  "summary" : "IdMap from_iter may lead to uninitialized memory being freed on drop",
  "details" : "Due to a flaw in the constructor `id_map::IdMap::from_iter`, ill-formed objects may be created in which the amount of actually initialized memory is less than what is expected by the fields of `IdMap`. Specifically, the field `ids` is initialized based on the capacity of the vector `values`, which is constructed from the provided iterator. However, the length of this vector may be smaller than its capacity.\n\nIn such cases, when the resulting `IdMap` is dropped, its destructor incorrectly assumes that `values` contains `ids.len() == values.capacity()` initialized elements and attempts to iterate over and drop them. This leads to dereferencing and attempting to free uninitialized memory, resulting in undefined behavior and potential segmentation faults.\n\nThe bug was fixed in commit `fab6922`, and all unsafe code was removed from the crate.\n\nNote that the maintainer recommends using the following alternatives:\n- [slab](https://crates.io/crates/slab)\n- [slotmap](https://crates.io/crates/slotmap)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "id-map"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.1.6"
      }, {
        "fixed" : "0.2.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/andrewhickman/id-map/issues/4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/andrewhickman/id-map/commit/fab6922b955b5a2986dfff2ccb341628faec30ed"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/andrewhickman/id-map"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2025-0050.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-665" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-18T15:10:15Z",
    "nvd_published_at" : null
  }
}