Skip to content

Commit 3132898

Browse files
committed
Use correct input to find structural bits
1 parent 20bc328 commit 3132898

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![deny(warnings)]
22
#![cfg_attr(feature = "hints", feature(core_intrinsics))]
3-
#![deny(warnings)]
43
#![warn(unused_extern_crates)]
54
#![deny(
65
clippy::all,
@@ -485,13 +484,14 @@ impl<'de> Deserializer<'de> {
485484
len,
486485
);
487486

488-
input_buffer.as_mut_ptr().add(len).write(0);
487+
let to_fill = input_buffer.capacity() - len;
488+
std::ptr::write_bytes(input_buffer.as_mut_ptr().add(len), 0, to_fill);
489489

490-
input_buffer.set_len(len);
490+
input_buffer.set_len(input_buffer.capacity());
491491
};
492492

493493
let s1_result: std::result::Result<Vec<u32>, ErrorType> =
494-
unsafe { Self::find_structural_bits(input_buffer) };
494+
unsafe { Self::find_structural_bits(input) };
495495

496496
let structural_indexes = match s1_result {
497497
Ok(i) => i,

0 commit comments

Comments
 (0)