From 95284856783b824a714b7506762f4adce3bb17ce Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Wed, 7 Sep 2022 00:31:10 +0100 Subject: Fix length check in XftTextExtents*. Commit 06a3c0ab6520e368ac936cb1ef172f19957db0fa added length checks of the form "if (len <= 0) return;" to various Xft functions. However, while rendering an empty string is equivalent to doing nothing, asking for the extents of an empty string isn't -- it still needs to fill in the extents structure. This broke text rendering in some applications (e.g. xpdf's Motif GUI). Check for len < 0 in XftTextExtents* instead. --- src/xftextent.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xftextent.c b/src/xftextent.c index 20d52db..debf73e 100644 --- a/src/xftextent.c +++ b/src/xftextent.c @@ -123,7 +123,7 @@ XftTextExtents8 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; - if (len <= 0) + if (len < 0) return; if (len <= NUM_LOCAL) @@ -154,7 +154,7 @@ XftTextExtents16 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; - if (len <= 0) + if (len < 0) return; if (len <= NUM_LOCAL) @@ -185,7 +185,7 @@ XftTextExtents32 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; - if (len <= 0) + if (len < 0) return; if (len <= NUM_LOCAL) @@ -219,7 +219,7 @@ XftTextExtentsUtf8 (Display *dpy, int l; int size; - if (len <= 0) + if (len < 0) return; i = 0; @@ -266,7 +266,7 @@ XftTextExtentsUtf16 (Display *dpy, int l; int size; - if (len <= 0) + if (len < 0) return; i = 0; -- cgit v1.2.1