We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4d7d103 commit b3de3bbCopy full SHA for b3de3bb
zk_ee/src/utils/aligned_vector.rs
@@ -120,6 +120,11 @@ impl<A: Allocator> UsizeAlignedByteBox<A> {
120
alloc::boxed::Box::new_uninit_slice_in(buffer_size, allocator);
121
let written_words = init_fn(&mut inner);
122
assert!(written_words <= buffer_size); // we do not want to truncate or realloc, but we will expose only written part below
123
+ // Safety: init_fn only guarantees that it initialized `written_words` elements.
124
+ // Initialize the remainder to avoid UB in assume_init().
125
+ for dst in inner.iter_mut().skip(written_words) {
126
+ dst.write(0);
127
+ }
128
let byte_capacity = written_words * USIZE_SIZE; // we only count initialized words for capacity purposes
129
130
Self {
0 commit comments