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_bufferallocates a buffer usingVec::with_capacityfollowed byset_len, creating aBox<[T]>containing uninitialized memory.This leads to undefined behavior when functions like
write_slicescreate 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_withto properly initialize the buffer withT::default(), adding aT: Defaultbound to ensure sound initialization.References