# GHSA-fp5x-7m4q-449f: Direct Ring Buffer has uninitialized memory exposure in create_ring_buffer

> Uninitialized memory exposure in create_ring_buffer allows undefined behavior, potentially leading to code execution or information disclosure.

- **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:** 21 Oct 2025
- **Also known as:** RUSTSEC-2025-0105

## What is GHSA-fp5x-7m4q-449f?

GHSA-fp5x-7m4q-449f is a memory corruption vulnerability in direct_ring_buffer, published on 21 Oct 2025. 

### Official description

The safe function `create_ring_buffer` allocates a buffer using `Vec::with_capacity` followed by `set_len`, creating a `Box<[T]>` containing uninitialized memory.

This leads to undefined behavior when functions like `write_slices` create typed slices (e.g., `&mut [bool]`) over the uninitialized memory, violating Rust's validity invariants. The issue has been confirmed using Miri.

Fixed in version 0.2.2 by using `resize_with` to properly initialize the buffer with `T::default()`, adding a `T: Default` bound to ensure sound initialization.

## Which versions are affected by GHSA-fp5x-7m4q-449f?

3 open source packages ship an affected version, including direct_ring_buffer.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `direct_ring_buffer` | crates.io | All versions | 0.2.2 |
| `direct_ring_buffer` | crates.io | All versions | 0.2.2 |
| `direct_ring_buffer` | crates.io | From 0.0.0-0 | 0.2.2 |

## How do I fix GHSA-fp5x-7m4q-449f?

Upgrade direct_ring_buffer to 0.2.2 or later.

## Is GHSA-fp5x-7m4q-449f being exploited?

There is no known exploitation of GHSA-fp5x-7m4q-449f in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-fp5x-7m4q-449f and fix it if it is affected.

What it is: GHSA-fp5x-7m4q-449f is a memory corruption vulnerability in direct_ring_buffer, published on 21 Oct 2025. 
Exploitation: There is no known exploitation of GHSA-fp5x-7m4q-449f in the wild and no public exploit code.

Affected packages and fixed versions:
- direct_ring_buffer (crates.io): affected all versions; fixed in 0.2.2
- direct_ring_buffer (crates.io): affected all versions; fixed in 0.2.2
- direct_ring_buffer (crates.io): affected from 0.0.0-0; fixed in 0.2.2

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-fp5x-7m4q-449f/ (Markdown: https://insights.sbomify.com/GHSA-fp5x-7m4q-449f/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-fp5x-7m4q-449f

---
From sbomify Insights: https://insights.sbomify.com/GHSA-fp5x-7m4q-449f/
Summaries are generated and may contain mistakes; the official description above is the record.
