diff options
author | marha <marha@users.sourceforge.net> | 2014-05-11 17:43:25 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-05-11 17:43:25 +0200 |
commit | 26dfcdba6c306d6312c598e4191449302329be68 (patch) | |
tree | 2bf56b5a0eb2cc554833fdc6e08f2b59f1bfdabd /xorg-server/glamor/glamor_text.c | |
parent | 2dc2880eacae3d52f4ab4bb5ec43c5bbf50c5c3f (diff) | |
parent | ae06feae7876db47ff0e1fde40cf4a324a412037 (diff) | |
download | vcxsrv-26dfcdba6c306d6312c598e4191449302329be68.tar.gz vcxsrv-26dfcdba6c306d6312c598e4191449302329be68.tar.bz2 vcxsrv-26dfcdba6c306d6312c598e4191449302329be68.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/src/mesa/main/imports.h
Diffstat (limited to 'xorg-server/glamor/glamor_text.c')
-rw-r--r-- | xorg-server/glamor/glamor_text.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/xorg-server/glamor/glamor_text.c b/xorg-server/glamor/glamor_text.c index 395116d5b..6e02b9aa8 100644 --- a/xorg-server/glamor/glamor_text.c +++ b/xorg-server/glamor/glamor_text.c @@ -37,6 +37,7 @@ glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font, unsigned long nglyphs; FontEncoding encoding; int char_step; + int c; if (sixteen) { char_step = 2; @@ -49,7 +50,7 @@ glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font, encoding = Linear8Bit; } - /* If the font has a default character, then we don't have to + /* If the font has a default character, then we shouldn't have to * worry about missing glyphs, so just get the whole string all at * once. Otherwise, we have to fetch chars one at a time to notice * missing ones. @@ -57,15 +58,28 @@ glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font, if (glamor_font->default_char) { GetGlyphs(font, (unsigned long) count, (unsigned char *) chars, encoding, &nglyphs, charinfo); - } else { - int c; - for (c = 0; c < count; c++) { - GetGlyphs(font, 1, (unsigned char *) chars, - encoding, &nglyphs, &charinfo[c]); - if (!nglyphs) - charinfo[c] = NULL; - chars += char_step; - } + + /* Make sure it worked. There's a bug in libXfont through + * version 1.4.7 which would cause it to fail when the font is + * a 2D font without a first row, and the application sends a + * 1-d request. In this case, libXfont would return zero + * glyphs, even when the font had a default character. + * + * It's easy enough for us to work around that bug here by + * simply checking the returned nglyphs and falling through to + * the one-at-a-time code below. Not doing this check would + * result in uninitialized memory accesses in the rendering code. + */ + if (nglyphs == count) + return; + } + + for (c = 0; c < count; c++) { + GetGlyphs(font, 1, (unsigned char *) chars, + encoding, &nglyphs, &charinfo[c]); + if (!nglyphs) + charinfo[c] = NULL; + chars += char_step; } } @@ -508,7 +522,7 @@ Bool glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc, int x, int y, int count, unsigned short *chars) { - return glamor_image_text(drawable, gc, x, y, count, (char *) chars, FALSE); + return glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE); } void |