Prevent GraphemeStrs created from Strings from leaking (#7920)
commit01776e685103032daccbc0d319f0aceed3bb9156
authorDillard Robertson <32615829+dilr@users.noreply.github.com>
dateSat 12 Aug 2023, 21:13 (3 years ago)
parentee3171c
helix-core/src/graphemes.rs+1−1
@@ -481,7 +481,7 @@ impl<'a> From<String> for GraphemeStr<'a> {
481481 let ptr = Box::into_raw(g.into_bytes().into_boxed_slice()) as *mut u8;
482482 GraphemeStr {
483483 ptr: unsafe { NonNull::new_unchecked(ptr) },
484− len: i32::try_from(len).unwrap() as u32,
484+ len: (i32::try_from(len).unwrap() as u32) | Self::MASK_OWNED,
485485 phantom: PhantomData,
486486 }
487487 }