[bdf] Fix Savannah bug #35656. * src/bdf/bdflib.c (_bdf_parse_glyphs) <_BDF_BITMAP>: Check validity of nibble characters instead of accessing `a2i' array.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
diff --git a/ChangeLog b/ChangeLog
index 51c129e..2dc9673 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2012-03-01 Werner Lemberg <wl@gnu.org>
+ [bdf] Fix Savannah bug #35656.
+
+ * src/bdf/bdflib.c (_bdf_parse_glyphs) <_BDF_BITMAP>: Check validity
+ of nibble characters instead of accessing `a2i' array.
+
+2012-03-01 Werner Lemberg <wl@gnu.org>
+
[winfonts] Fix Savannah bug #35659.
* src/winfonts/winfnt.c (FNT_Face_Init): Check number of glyphs.
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index fc635c9..6a66d1d 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1746,7 +1746,7 @@
for ( i = 0; i < nibbles; i++ )
{
c = line[i];
- if ( !c )
+ if ( !isdigok( hdigits, c ) )
break;
*bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );
if ( i + 1 < nibbles && ( i & 1 ) )
@@ -1769,9 +1769,9 @@
*bp &= nibble_mask[mask_index];
/* If any line has extra columns, indicate they have been removed. */
- if ( i == nibbles &&
- ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) &&
- !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
+ if ( i == nibbles &&
+ isdigok( hdigits, line[nibbles] ) &&
+ !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
{
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding ));
p->flags |= _BDF_GLYPH_WIDTH_CHECK;