Commit ea5babaa67eeed68041a73933e0a7271960c0505

Werner Lemberg 2010-06-25T22:44:37

Fix Savannah bug #30261. * src/pfr/pfrobjs.c (pfr_face_init): Reject fonts which contain neither outline nor bitmap glyphs.

diff --git a/ChangeLog b/ChangeLog
index 91fa85c..72abfac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-06-25  Werner Lemberg  <wl@gnu.org>
 
+	Fix Savannah bug #30261.
+
+	* src/pfr/pfrobjs.c (pfr_face_init): Reject fonts which contain
+	neither outline nor bitmap glyphs.
+
+2010-06-25  Werner Lemberg  <wl@gnu.org>
+
 	Fix Savannah bug #30254.
 
 	* src/cff/cffload.c (cff_index_get_pointers): Do sanity check for
diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c
index 56d617d..307e6d3 100644
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR object methods (body).                                  */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 by                  */
+/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by            */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -146,8 +146,17 @@
           if ( phy_font->chars[nn].gps_offset != 0 )
             break;
 
-        if ( nn == phy_font->num_chars )
-          pfrface->face_flags = 0;        /* not scalable */
+        if ( phy_font->num_strikes > 0 )
+        {
+          if ( nn == phy_font->num_chars )
+            pfrface->face_flags = 0;        /* not scalable */
+        }
+        else
+        {
+          FT_ERROR(( "pfr_face_init: font doesn't contain glyphs\n" ));
+          error = PFR_Err_Invalid_File_Format;
+          goto Exit;
+        }
       }
 
       if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 )