w32: fail gracefully when using invalid glyphs on DWrite

* src/w32dwrite.c (text_extents_internal): Return false instead
of crashing with bad glyph indexes.  (Bug#77196)
This commit is contained in:
Cecilio Pardo 2025-03-27 13:26:00 +01:00 committed by Eli Zaretskii
parent 555ec43a32
commit 33a46ff565

View file

@ -610,6 +610,14 @@ text_extents_internal (IDWriteFontFace *dwrite_font_face,
nglyphs,
gmetrics,
false);
/* E_INVALIDARG means some of the glyphs index is out of bounds for the font. */
if (hr == E_INVALIDARG)
{
SAFE_FREE ();
return false;
}
if (!verify_hr (hr, "Failed to GetGdiCompatibleGlyphMetrics"))
{
SAFE_FREE ();