# RUSTSEC-2025-0105: Uninitialized memory exposure in create\_ring\_buffer

- Database: RustSec
- Published: 2025-10-21
- Modified: 2025-10-28

## Also published as

- [GHSA-FP5X-7M4Q-449F](https://cve.now/GHSA-FP5X-7M4Q-449F.md) (GitHub)

## Affected versions

- direct\_ring\_buffer (crates.io): fixed in 0.2.2

## 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.

## References

- https://crates.io/crates/direct_ring_buffer
- https://rustsec.org/advisories/RUSTSEC-2025-0105.html
- https://github.com/ain1084/direct_ring_buffer/issues/1
- https://github.com/ain1084/direct_ring_buffer/pull/2

Page: https://cve.now/RUSTSEC-2025-0105

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
