Do not crash libXfont on freetype 2.1.10

Michael G michael.micg at gmail.com
Thu Oct 6 01:26:16 PDT 2005


Here is a "diff -urNpad" that prevents a crash on
'Monotype Courier New' version 2.90
==================================
====== xc/lib/font/FreeType/ftfuncs.c: ======
==================================
--- ftfuncs.c.bad 2005-10-04 01:32:27.000000000 +0300
+++ ftfuncs.c.good 2005-10-04 01:12:29.000000000 +0300
@@ -932,9 +932,18 @@ FT_Do_SBit_Metrics( FT_Face ft_face, FT_
sfnt = (SFNT_Service)face->sfnt;

if ( strike_index != 0xFFFFU && sfnt->load_sbits ) {
- /* Check whether there is a glyph sbit for the current index */
- error = sfnt->find_sbit_image( face, glyph_index, strike_index,
+ /*
+ * A sanity check. `Monotype Courier New' version 2.90 crashes
+ * xfs or X servers. Freetype 2.1.10 sets
+ * sfnt->find_sbit_image to 0 in sfnt_interface in
+ * freetype-2.1.10/src/sfntsfdriver.c on line 370.
+ */
+ if (sfnt && sfnt->find_sbit_image) {
+ /* Check whether there is a glyph sbit for the current index */
+ error = sfnt->find_sbit_image( face, glyph_index, strike_index,
&range, &strike, &glyph_offset );
+ }
+ else error = -1; /* Need this in case sfnt->find_sbit_image is 0 */
}
else error=-1;
if ( error ) goto Exit;

=================================================
=========== CUT ====== EOF ========================
=================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20051006/0a5ae8c3/attachment.html>


More information about the xorg mailing list