Skip to content

Commit

Permalink
Prevent GraphemeStrs created from Strings from leaking (helix-editor#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dilr authored and dgkf committed Jan 30, 2024
1 parent dd95345 commit b586a71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-core/src/graphemes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down

0 comments on commit b586a71

Please sign in to comment.