[bdf] Fix Savannah bugs #35599 and #35600.

* src/bdf/bdflib.c (ACMSG16): New warning message.
(_bdf_parse_glyphs) <_BDF_BITMAP>: Check line length.
This commit is contained in:
Werner Lemberg 2012-02-25 10:23:04 +01:00
parent 320d4976d1
commit 0b1c0c6b20
2 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2012-02-25 Werner Lemberg <wl@gnu.org>
[bdf] Fix Savannah bugs #35599 and #35600.
* src/bdf/bdflib.c (ACMSG16): New warning message.
(_bdf_parse_glyphs) <_BDF_BITMAP>: Check line length.
2012-02-24 Werner Lemberg <wl@gnu.org>
[bdf] Fix Savannah bugs #35597 and #35598.

View File

@ -188,6 +188,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"
@ -1725,18 +1726,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 ));