Prevent GraphemeStrs created from Strings from leaking (#7920)

main
Dillard Robertson 1 year ago committed by GitHub
parent ee3171cc54
commit 01776e6851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -481,7 +481,7 @@ impl<'a> From<String> for GraphemeStr<'a> {
let ptr = Box::into_raw(g.into_bytes().into_boxed_slice()) as *mut u8;
GraphemeStr {
ptr: unsafe { NonNull::new_unchecked(ptr) },
len: i32::try_from(len).unwrap() as u32,
len: (i32::try_from(len).unwrap() as u32) | Self::MASK_OWNED,
phantom: PhantomData,
}
}

Loading…
Cancel
Save