Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 764c577bb9f3af3549ecc920f98f8270 > files > 7

freetype2-2.4.4-5.5.mga1.src.rpm

diff -Naurp freetype-2.4.5/src/bdf/bdflib.c freetype-2.4.5.oden/src/bdf/bdflib.c
--- freetype-2.4.5/src/bdf/bdflib.c	2012-04-12 07:15:50.000000000 +0000
+++ freetype-2.4.5.oden/src/bdf/bdflib.c	2012-04-12 07:16:08.000000000 +0000
@@ -1098,6 +1098,7 @@
 #define ACMSG13  "Glyph %ld extra rows removed.\n"
 #define ACMSG14  "Glyph %ld extra columns removed.\n"
 #define ACMSG15  "Incorrect glyph count: %ld indicated but %ld found.\n"
+#define ACMSG16  "Glyph %ld missing columns padded with zero bits.\n"
 
   /* Error messages. */
 #define ERRMSG1  "[line %ld] Missing \"%s\" line.\n"
@@ -1702,18 +1703,31 @@
       for ( i = 0; i < nibbles; i++ )
       {
         c = line[i];
+        if ( !c )
+          break;
         *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );
         if ( i + 1 < nibbles && ( i & 1 ) )
           *++bp = 0;
       }
 
+      /* If any line has not enough columns,            */
+      /* indicate they have been padded with zero bits. */
+      if ( i < nibbles                            &&
+           !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
+      {
+        FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding ));
+        p->flags       |= _BDF_GLYPH_WIDTH_CHECK;
+        font->modified  = 1;
+      }
+
       /* Remove possible garbage at the right. */
       mask_index = ( glyph->bbx.width * p->font->bpp ) & 7;
       if ( glyph->bbx.width )
         *bp &= nibble_mask[mask_index];
 
       /* If any line has extra columns, indicate they have been removed. */
-      if ( ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) &&
+      if ( i == nibbles                                             &&
+           ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) &&
            !( p->flags & _BDF_GLYPH_WIDTH_CHECK )                   )
       {
         FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding ));