Fix Savannah bug #30052. This bug has been introduced with commit 2415cbf3. * src/base/ftobjs.c (FT_Get_First_Char, FT_Get_Next_Char): Protect against endless loop in case of corrupted font header data.
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
diff --git a/ChangeLog b/ChangeLog
index bb37486..a7375f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-07 Werner Lemberg <wl@gnu.org>
+
+ Fix Savannah bug #30052.
+ This bug has been introduced with commit 2415cbf3.
+
+ * src/base/ftobjs.c (FT_Get_First_Char, FT_Get_Next_Char): Protect
+ against endless loop in case of corrupted font header data.
+
2010-05-26 Werner Lemberg <wl@gnu.org>
Remove unused variable.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index ad34998..17fa820 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -3111,7 +3111,7 @@
FT_UInt gindex = 0;
- if ( face && face->charmap )
+ if ( face && face->charmap && face->num_glyphs )
{
gindex = FT_Get_Char_Index( face, 0 );
if ( gindex == 0 || gindex >= (FT_UInt)face->num_glyphs )
@@ -3136,7 +3136,7 @@
FT_UInt gindex = 0;
- if ( face && face->charmap )
+ if ( face && face->charmap && face->num_glyphs )
{
FT_UInt32 code = (FT_UInt32)charcode;
FT_CMap cmap = FT_CMAP( face->charmap );