summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Wang <Derek.Wang@sun.com>2011-02-02 22:15:13 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-02-13 16:54:21 -0800
commitd274ffc91b22bb8f3a2447237491cbe04f2ee0c3 (patch)
treed18932b263c4f6894d6be0aee7dbf97c04c2d49a
parent652d9b47fc902e12c8e28481742c382676f1d035 (diff)
downloadxorg-lib-libXft-d274ffc91b22bb8f3a2447237491cbe04f2ee0c3.tar.gz
XftGlyphFontSpecCore: check to make sure glyphs are in range
This fixes a crash reported when selecting "View Page Source" in Mozilla on Solaris 10, due to invalid parameters being given to XPutImage. http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6261221 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/xftcore.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/xftcore.c b/src/xftcore.c
index 3f87109..a0103cf 100644
--- a/src/xftcore.c
+++ b/src/xftcore.c
@@ -1253,7 +1253,17 @@ XftGlyphFontSpecCore (XftDraw *draw,
if (i)
{
if (g_x1 < x1)
+ {
+ if (g_x1 < 0)
+ {
+ /* do nothing if the given glyphs are out of range */
+ short t = glyphs[i-1].font->max_advance_width
+ + glyphs[i-1].x;
+ if (t < 0 && glyphs[i-1].x > 0)
+ goto bail1;
+ }
x1 = g_x1;
+ }
if (g_y1 < y1)
y1 = g_y1;
if (g_x2 > x2)