Commit d2d843a01ce7815c11458eb0c1a319a525139af1

suzuki toshiya 2010-09-20T01:28:17

[cff] Ignore CID > 0xFFFFU. See Savannah bug #30975. * src/cff/cffload.c (cff_charset_compute_cids): Ignore CID if greater than 0xFFFFU. CFF font spec does not mention about maximum CID in the font, but PostScript and PDF spec define that maximum CID is 0xFFFFU.

diff --git a/ChangeLog b/ChangeLog
index ea1daa2..8544a41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2010-09-19  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
+	[cff] Ignore CID > 0xFFFFU.
+	See Savannah bug #30975.
+
+	* src/cff/cffload.c (cff_charset_compute_cids): Ignore CID if
+	greater than 0xFFFFU.  CFF font spec does not mention about
+	maximum CID in the font, but PostScript and PDF spec define
+	that maximum CID is 0xFFFFU.
+
+2010-09-19  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
 	[cff] Make trace message in cff_charset_load() verbose.
 	See Savannah bug #30975.
 
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 6a1842f..8f29343 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -779,8 +779,15 @@
       goto Exit;
 
     for ( i = 0; i < num_glyphs; i++ )
-      if ( charset->sids[i] > max_cid )
+    {
+      if ( charset->sids[i] > 0xFFFFU )
+        FT_ERROR(( "cff_charset_compute_cids():"
+                   " ignore CID (0x%lx) for SID (0x%lx),"
+                   " greater than PS/PDF spec\n",
+                   charset->sids[i], i ));
+      else if ( charset->sids[i] > max_cid )
         max_cid = charset->sids[i];
+    }
 
     if ( FT_NEW_ARRAY( charset->cids, max_cid + 1 ) )
       goto Exit;