# GHSA-xrrq-rrgq-h89w: Uninitialized read after allocating MemBump

> An uninitialized memory read in MemBump allocation can cause assertion failures and denial of service in Rust applications using this library.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Jul 2025
- **Also known as:** RUSTSEC-2025-0042

## What is GHSA-xrrq-rrgq-h89w?

GHSA-xrrq-rrgq-h89w is a memory corruption vulnerability in static-alloc, published on 11 Jul 2025. 

### Official description

The affected function, `MemBump::new()`, would allocate memory without
initializing it. Subsequently calling the created value's various `alloc`
methods would then read and write the start of that memory as a `Cell` which is
undefined behavior. Instead, it should zero initialize the start of the
allocated memory.

For instance, some values could violate the internal invariants of the type and
cause an assertion failure. Nevertheless, no deterministic read is known to
cause further uninitialized memory to be exposed.

Affected downstream users that can not upgrade are advised to call
`MemBump::reset` immediately after allocation to manually perform the missing
write of the counter best-as-possible.

The flaw was corrected in commit d8d6a7d096d3aaafd963b356a8f1bbd8d26fd967 by
zeroing the Cell at the start of the allocated memory.

## Which versions are affected by GHSA-xrrq-rrgq-h89w?

3 open source packages ship an affected version, including static-alloc.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `static-alloc` | crates.io | From 0.2.2 | 0.2.6 |
| `static-alloc` | crates.io | From 0.2.2 | 0.2.6 |
| `static-alloc` | crates.io | From 0.2.2-0 | 0.2.6 |

## How do I fix GHSA-xrrq-rrgq-h89w?

Upgrade static-alloc to 0.2.6 or later.

## Is GHSA-xrrq-rrgq-h89w being exploited?

There is no known exploitation of GHSA-xrrq-rrgq-h89w in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-xrrq-rrgq-h89w and fix it if it is affected.

What it is: GHSA-xrrq-rrgq-h89w is a memory corruption vulnerability in static-alloc, published on 11 Jul 2025. 
Exploitation: There is no known exploitation of GHSA-xrrq-rrgq-h89w in the wild and no public exploit code.

Affected packages and fixed versions:
- static-alloc (crates.io): affected from 0.2.2; fixed in 0.2.6
- static-alloc (crates.io): affected from 0.2.2; fixed in 0.2.6
- static-alloc (crates.io): affected from 0.2.2-0; fixed in 0.2.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-xrrq-rrgq-h89w/ (Markdown: https://insights.sbomify.com/GHSA-xrrq-rrgq-h89w/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-xrrq-rrgq-h89w

---
From sbomify Insights: https://insights.sbomify.com/GHSA-xrrq-rrgq-h89w/
Summaries are generated and may contain mistakes; the official description above is the record.
