Commit 8e58ff26d2fa8be5c5b49b8298840f61b6f52543

Werner Lemberg 2005-02-14T07:25:07

* src/cff/cffcmap.c (cff_cmap_unicode_init): Don't try to build a cmap for a CID-keyed font which doesn't have SIDs.

diff --git a/ChangeLog b/ChangeLog
index 56bf06d..ffea9d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-14  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffcmap.c (cff_cmap_unicode_init): Don't try to build
+	a cmap for a CID-keyed font which doesn't have SIDs.
+
 2005-02-13  Werner Lemberg  <wl@gnu.org>
 
 	* src/type1/t1load.c (read_binary_data): Return more meaningful
diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c
index 82e04d2..88169d0 100644
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CFF character mapping table (cmap) support (body).                   */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004 by                                          */
+/*  Copyright 2002, 2003, 2004, 2005 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -149,6 +149,13 @@
     FT_Service_PsCMaps  psnames = (FT_Service_PsCMaps)cff->psnames;
 
 
+    /* can't build Unicode map for CID-keyed font */
+    if ( !charset->sids )
+    {
+      error = CFF_Err_Invalid_Argument;
+      goto Exit;
+    }
+
     cmap->num_pairs = 0;
     cmap->pairs     = NULL;
 
@@ -213,6 +220,7 @@
       }
     }
 
+  Exit:
     return error;
   }