diff --git a/crates/renderer/src/util.rs b/crates/renderer/src/util.rs index 08d9982..7cafc4d 100644 --- a/crates/renderer/src/util.rs +++ b/crates/renderer/src/util.rs @@ -558,14 +558,19 @@ impl CStringList { let mut bytes = vec![]; let mut strings = vec![]; i.into_iter().for_each(|s| { - strings.push(bytes.as_ptr_range().end as *const i8); + let start = bytes.len(); bytes.extend_from_slice(s.as_ref().as_bytes()); bytes.push(0); + strings.push(start); }); + let bytes = bytes.into_boxed_slice(); Self { - strings: strings.into_boxed_slice(), - bytes: bytes.into_boxed_slice(), + strings: strings + .into_iter() + .map(|offset| unsafe { bytes.as_ptr().offset(offset as isize) as *const i8 }) + .collect(), + bytes, } } }