From 01776e685103032daccbc0d319f0aceed3bb9156 Mon Sep 17 00:00:00 2001 From: Dillard Robertson <32615829+dilr@users.noreply.github.com> Date: Sat, 12 Aug 2023 21:13:06 -0400 Subject: [PATCH] Prevent GraphemeStrs created from Strings from leaking (#7920) --- helix-core/src/graphemes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-core/src/graphemes.rs b/helix-core/src/graphemes.rs index 15ef3eb04..d9e5e0224 100644 --- a/helix-core/src/graphemes.rs +++ b/helix-core/src/graphemes.rs @@ -481,7 +481,7 @@ impl<'a> From 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, } }