fix: 修复 oxide_builtins 整数溢出 panic 点与安全转换

This commit is contained in:
2026-09-21 14:11:20 +00:00
parent b4d281d109
commit fea24b6d26
19 changed files with 291 additions and 91 deletions
+3 -2
View File
@@ -268,8 +268,9 @@ pub(crate) fn map_well_formed_segments(units: &[u16], mut f: impl FnMut(&str) ->
i += 1;
continue;
}
let s = String::from_utf16(&units[seg_start..i]).expect("良形段 from_utf16 必成功");
out.extend(f(&s).encode_utf16());
if let Ok(s) = String::from_utf16(&units[seg_start..i]) {
out.extend(f(&s).encode_utf16());
}
}
out
}