Commit d61b042568d395ef7d55d0475db9203ae0f6b3cf

Werner Lemberg 2016-10-08T19:20:33

[cid] Fix parsing of subr offsets. Bug introduced 2016-05-16. * src/cid/cidparse.c (cid_parser_new): Fix off-by-one error.

diff --git a/ChangeLog b/ChangeLog
index 70ffa94..be85355 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-10-08  Werner Lemberg  <wl@gnu.org>
+
+	[cid] Fix parsing of subr offsets.
+
+	Bug introduced 2016-05-16.
+
+	* src/cid/cidparse.c (cid_parser_new): Fix off-by-one error.
+
 2016-10-01  Werner Lemberg  <wl@gnu.org>
 
 	[sfnt] Disable bitmap strikes if we don't have a bitmap data table.
diff --git a/docs/CHANGES b/docs/CHANGES
index c7c2cd4..f0eddc5 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -6,6 +6,9 @@ CHANGES BETWEEN 2.7 and 2.7.1
 
   II. IMPORTANT BUG FIXES
 
+    - Handling of  raw CID fonts was partially  broken (bug introduced
+      in 2.6.4).
+
 
   III. MISCELLANEOUS
 
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index 8dce7f9..1b27b2e 100644
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -138,13 +138,13 @@
                ft_strncmp( (char*)p, STARTDATA, STARTDATA_LEN ) == 0 )
           {
             /* save offset of binary data after `StartData' */
-            offset += (FT_ULong)( p - buffer ) + STARTDATA_LEN;
+            offset += (FT_ULong)( p - buffer ) + STARTDATA_LEN + 1;
             goto Found;
           }
           else if ( p[1] == 's'                                   &&
                     ft_strncmp( (char*)p, SFNTS, SFNTS_LEN ) == 0 )
           {
-            offset += (FT_ULong)( p - buffer ) + SFNTS_LEN;
+            offset += (FT_ULong)( p - buffer ) + SFNTS_LEN + 1;
             goto Found;
           }
         }