diff options
| author | Cecilio Pardo | 2025-03-27 13:26:00 +0100 |
|---|---|---|
| committer | Eli Zaretskii | 2025-03-27 15:01:53 +0200 |
| commit | 33a46ff565296b491e808aa63d1dbaa2d994bbb5 (patch) | |
| tree | 4326c6b40699138b4d9a76c970f91477079c2cc2 /src | |
| parent | 555ec43a32ea8f3675c5a9d73ca30609eeaa9013 (diff) | |
| download | emacs-33a46ff565296b491e808aa63d1dbaa2d994bbb5.tar.gz emacs-33a46ff565296b491e808aa63d1dbaa2d994bbb5.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32dwrite.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/w32dwrite.c b/src/w32dwrite.c index 4dc65b15db7..10af8545a11 100644 --- a/src/w32dwrite.c +++ b/src/w32dwrite.c | |||
| @@ -610,6 +610,14 @@ text_extents_internal (IDWriteFontFace *dwrite_font_face, | |||
| 610 | nglyphs, | 610 | nglyphs, |
| 611 | gmetrics, | 611 | gmetrics, |
| 612 | false); | 612 | false); |
| 613 | |||
| 614 | /* E_INVALIDARG means some of the glyphs index is out of bounds for the font. */ | ||
| 615 | if (hr == E_INVALIDARG) | ||
| 616 | { | ||
| 617 | SAFE_FREE (); | ||
| 618 | return false; | ||
| 619 | } | ||
| 620 | |||
| 613 | if (!verify_hr (hr, "Failed to GetGdiCompatibleGlyphMetrics")) | 621 | if (!verify_hr (hr, "Failed to GetGdiCompatibleGlyphMetrics")) |
| 614 | { | 622 | { |
| 615 | SAFE_FREE (); | 623 | SAFE_FREE (); |