tags 302269 patch
thanks

Hi Lars, Anthony,

Here is a counter-patch which I think is a bit more elegant than the one
Lars proposed.  Rather than allocating extra memory for the bitmap of every
glyph including zero-width ones, this patch removes/wraps the two bits that
were trying to write out past the limit.  This solution is slightly more
prone to segfaulting if some other chunk of code tries to read from thee
address, but it shouldn't do that anyway -- better to fix that bug than to
leave it in place possibly resulting in the display of garbled glyphs, IMHO.

Either way, I'd say this bug can be tagged 'patch' now, and you can have
your pick of them. :)

Cheers,
-- 
Steve Langasek
postmodern programmer
diff -ur freetype-2.1.7.orig/src/bdf/bdflib.c freetype-2.1.7/src/bdf/bdflib.c
--- freetype-2.1.7.orig/src/bdf/bdflib.c        2003-10-15 15:20:56.000000000 
-0700
+++ freetype-2.1.7/src/bdf/bdflib.c     2005-04-24 02:46:31.858144092 -0700
@@ -1683,7 +1683,7 @@
       nibbles = glyph->bpr << 1;
       bp      = glyph->bitmap + p->row * glyph->bpr;
 
-      for ( i = 0, *bp = 0; i < nibbles; i++ )
+      for ( i = 0; i < nibbles; i++ )
       {
         c = line[i];
         *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );
@@ -1693,7 +1693,8 @@
 
       /* Remove possible garbage at the right. */
       mask_index = ( glyph->bbx.width * p->font->bpp ) & 7;
-      *bp &= nibble_mask[mask_index];
+      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 ) &&

Attachment: signature.asc
Description: Digital signature

Reply via email to