From d087199f2c1388024b37fb3c3836e103aeded6c0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 7 Jun 2010 08:46:01 +0200 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ src/base/ftobjs.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb374865e..a7375f6fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-06-07 Werner Lemberg + + 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 Remove unused variable. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index ad3499849..17fa82073 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 );