Direct Ring Buffer has uninitialized memory exposure in create_ring_buffer
Low severity
GitHub Reviewed
Published
Oct 21, 2025
to the GitHub Advisory Database
•
Updated Oct 21, 2025
Description
Published to the GitHub Advisory Database
Oct 21, 2025
Reviewed
Oct 21, 2025
Last updated
Oct 21, 2025
The safe function
create_ring_buffer
allocates a buffer usingVec::with_capacity
followed byset_len
, creating aBox<[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 withT::default()
, adding aT: Default
bound to ensure sound initialization.References