Skip to content

Commit 29884e6

Browse files
anderskijl
authored andcommitted
Fix buffer overread in format_escaped_str
Fixes #452, probably. Signed-off-by: Anders Kaseorg <[email protected]>
1 parent c825472 commit 29884e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/serialize/writer/simd.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ macro_rules! impl_format_simd {
9595
}
9696

9797
while nb > 0 {
98-
let v = StrVector::from_slice(core::slice::from_raw_parts(sptr, STRIDE));
98+
let mut v = StrVector::default();
99+
v.as_mut_array()[..nb].copy_from_slice(core::slice::from_raw_parts(sptr, nb));
99100
v.copy_to_slice(core::slice::from_raw_parts_mut(dptr, STRIDE));
100101
let mask = (v.simd_eq(blash) | v.simd_eq(quote) | v.simd_lt(x20)).to_bitmask()
101102
as u32

0 commit comments

Comments
 (0)