rustsec-2026-0267
Vulnerability from osv_rustsec
Published
2026-08-24 12:00
Modified
2026-08-25 02:41
Summary
Panic-safety unsoundness in `BitVecCore::clear` (double-free / use-after-free)
Details

BitVecCore::clear drops every occupied element with drop_in_place and only afterwards clears the occupancy bits and resets len. If an element's Drop panics, those metadata updates are skipped, so the slot of the already-dropped element stays marked as occupied. BitVecCore::drop calls clear() again, visits the same slot, and drops the element a second time — a double-free / use-after-free reachable from safe Rust.

Reachable via the public StableVec::clear and ExternStableVec::clear, which delegate to BitVecCore::clear.

Impact

  • CWE-415 (Double Free): the same allocation is freed twice.
  • CWE-416 (Use-After-Free): a freed allocation is accessed during a repeated Drop.

Reachable entirely from safe Rust via catch_unwind with element types whose Drop can panic. Confirmed under AddressSanitizer on 0.4.2.

Fix

Fixed in stable-vec 0.4.3 by removing each element via remove_at, which clears the occupancy bit before taking the value out.

Release 0.4.3 also fixes several other panic-safety issues found by the maintainer; see GHSA-mr2v-63pc-gmr4 and the 0.4.3 changelog for the full list.


{
  "affected": [
    {
      "database_specific": {
        "categories": [
          "memory-corruption"
        ],
        "cvss": null,
        "informational": "unsound"
      },
      "ecosystem_specific": {
        "affected_functions": null,
        "affects": {
          "arch": [],
          "functions": [
            "stable_vec::BitVecCore::clear"
          ],
          "os": []
        }
      },
      "package": {
        "ecosystem": "crates.io",
        "name": "stable-vec",
        "purl": "pkg:cargo/stable-vec"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0.0.0-0"
            },
            {
              "fixed": "0.4.3"
            }
          ],
          "type": "SEMVER"
        }
      ],
      "versions": []
    }
  ],
  "aliases": [
    "GHSA-mr2v-63pc-gmr4"
  ],
  "database_specific": {
    "license": "CC0-1.0"
  },
  "details": "`BitVecCore::clear` drops every occupied element with `drop_in_place` and only\nafterwards clears the occupancy bits and resets `len`. If an element\u0027s `Drop`\npanics, those metadata updates are skipped, so the slot of the already-dropped\nelement stays marked as occupied. `BitVecCore::drop` calls `clear()` again,\nvisits the same slot, and drops the element a second time \u2014 a double-free /\nuse-after-free reachable from safe Rust.\n\nReachable via the public `StableVec::clear` and `ExternStableVec::clear`, which\ndelegate to `BitVecCore::clear`.\n\n## Impact\n\n* CWE-415 (Double Free): the same allocation is freed twice.\n* CWE-416 (Use-After-Free): a freed allocation is accessed during a repeated `Drop`.\n\nReachable entirely from safe Rust via `catch_unwind` with element types whose\n`Drop` can panic. Confirmed under AddressSanitizer on 0.4.2.\n\n## Fix\n\nFixed in `stable-vec` 0.4.3 by removing each element via `remove_at`, which\nclears the occupancy bit before taking the value out.\n\nRelease 0.4.3 also fixes several other panic-safety issues found by the\nmaintainer; see [GHSA-mr2v-63pc-gmr4](https://github.com/LukasKalbertodt/stable-vec/security/advisories/GHSA-mr2v-63pc-gmr4)\nand the 0.4.3 changelog for the full list.",
  "id": "RUSTSEC-2026-0267",
  "modified": "2026-08-25T02:41:54Z",
  "published": "2026-08-24T12:00:00Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://crates.io/crates/stable-vec"
    },
    {
      "type": "ADVISORY",
      "url": "https://rustsec.org/advisories/RUSTSEC-2026-0267.html"
    },
    {
      "type": "WEB",
      "url": "https://github.com/LukasKalbertodt/stable-vec/pull/51"
    }
  ],
  "related": [],
  "severity": [],
  "summary": "Panic-safety unsoundness in `BitVecCore::clear` (double-free / use-after-free)"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…

Loading…