diff options
author | Adam Sampson <ats@offog.org> | 2022-09-07 00:31:10 +0100 |
---|---|---|
committer | Adam Sampson <ats@offog.org> | 2022-09-07 00:41:06 +0100 |
commit | 95284856783b824a714b7506762f4adce3bb17ce (patch) | |
tree | 68b79bc20dcc1613a98eb3700244df39190a5dcd | |
parent | c6309d4c8fcb5f4879cc25cf81b649f5eb665413 (diff) | |
download | xorg-lib-libXft-95284856783b824a714b7506762f4adce3bb17ce.tar.gz |
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.
-rw-r--r-- | src/xftextent.c | 10 |
1 files 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; |