shithub: freetype+ttf2subf

Download patch

ref: 6d403d089d438f3a3f9a13c47e2c93528819f265
parent: 0da0faf0fb14eda88cd0a14e41c6727f32e89ce9
author: Werner Lemberg <[email protected]>
date: Sun Sep 24 05:06:01 EDT 2017

Fix handling of ValueRecords.

For GPOS pair positioning format 1 the description of ValueRecords
in the OpenType specification (1.8.2, from today) is wrong – the
offset has to be taken from the parent structure; in this case the
`PairSet' table.

* src/otvalid/otvgpos.c (otv_PairSet_validate): Set `extra3'.
(otv_PairPos_validate): Adjust.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,18 @@
 	* build/windows/ftver.rc: New VERSIONINFO resource.
 	* build/windows/vc2010/freetype.vcxproj: Further improvements.
 
+2017-09-24  Werner Lemberg  <[email protected]>
+
+	[otvalid] Fix handling of ValueRecords.
+
+	For GPOS pair positioning format 1 the description of ValueRecords
+	in the OpenType specification (1.8.2, from today) is wrong – the
+	offset has to be taken from the parent structure; in this case the
+	`PairSet' table.
+
+	* src/otvalid/otvgpos.c (otv_PairSet_validate): Set `extra3'.
+	(otv_PairPos_validate): Adjust.
+
 2017-09-23  Werner Lemberg  <[email protected]>
 
 	[otvalid] Handle `GSUB' and `GPOS' v1.1 tables.
--- a/src/otvalid/otvgpos.c
+++ b/src/otvalid/otvgpos.c
@@ -218,10 +218,6 @@
         OTV_LIMIT_CHECK( 2 );
         OTV_OPTIONAL_OFFSET( device );
 
-        /* XXX: this value is usually too small, especially if the current */
-        /* ValueRecord is part of an array -- getting the correct table    */
-        /* size is probably not worth the trouble                          */
-
         table_size = p - otvalid->extra3;
 
         OTV_SIZE_CHECK( device );
@@ -426,6 +422,8 @@
   /*************************************************************************/
   /*************************************************************************/
 
+  /* sets otvalid->extra3 (pointer to base table) */
+
   static void
   otv_PairSet_validate( FT_Bytes       table,
                         FT_UInt        format1,
@@ -438,6 +436,8 @@
 
     OTV_NAME_ENTER( "PairSet" );
 
+    otvalid->extra3 = table;
+
     OTV_LIMIT_CHECK( 2 );
     PairValueCount = FT_NEXT_USHORT( p );
 
@@ -483,8 +483,6 @@
 
     OTV_TRACE(( " (format %d)\n", PosFormat ));
 
-    otvalid->extra3 = table;
-
     switch ( PosFormat )
     {
     case 1:     /* PairPosFormat1 */
@@ -538,6 +536,8 @@
 
         OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 *
                          ( len_value1 + len_value2 ) );
+
+        otvalid->extra3 = table;
 
         /* Class1Record */
         for ( ; ClassCount1 > 0; ClassCount1-- )