fix write_os_str_to_wide_str

This commit is contained in:
Ralf Jung
2021-05-19 16:34:14 +02:00
parent e4a27150cb
commit aba96b82b4
+1 -1
View File
@@ -146,7 +146,7 @@ fn os_str_to_u16vec<'tcx>(os_str: &OsStr) -> InterpResult<'tcx, Vec<u16>> {
let this = self.eval_context_mut();
let mut alloc = this
.memory
.get_mut(sptr, Size::from_bytes(string_length), Align::from_bytes(2).unwrap())?
.get_mut(sptr, size2 * string_length, Align::from_bytes(2).unwrap())?
.unwrap(); // not a ZST, so we will get a result
for (offset, wchar) in u16_vec.into_iter().chain(iter::once(0x0000)).enumerate() {
let offset = u64::try_from(offset).unwrap();