windows: Fix panic with some unicode characters (#10750)

Fix #10749 

Release Notes:

- N/A
This commit is contained in:
张小白 2024-04-19 13:28:39 +08:00 committed by GitHub
parent ea952b2a95
commit 9863b920b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -928,8 +928,11 @@ impl IDWriteTextRenderer_Impl for TextRenderer {
) -> windows::core::Result<()> {
unsafe {
let glyphrun = &*glyphrun;
let desc = &*glyphrundescription;
let glyph_count = glyphrun.glyphCount as usize;
if glyph_count == 0 {
return Ok(());
}
let desc = &*glyphrundescription;
let utf16_length_per_glyph = desc.stringLength as usize / glyph_count;
let context =
&mut *(clientdrawingcontext as *const RendererContext as *mut RendererContext);