shithub: freetype+ttf2subf

Download patch

ref: 2b79d25f2213aef0e3dc66f0e7f973fccede9c12
parent: e7ac8e40e881e8d56600b12c5bdefb47d18bdc03
author: Werner Lemberg <[email protected]>
date: Sat Sep 23 06:29:26 EDT 2017

[otvalid] Update common table handling to OpenType 1.8.2.

* src/otvalid/otvcommn.c (otv_Device_validate): Handle
VariationIndex subtable.
(otv_Lookup_validate): Handle MarkFilteringSet.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,14 @@
 	* build/windows/ftver.rc: New VERSIONINFO resource.
 	* build/windows/vc2010/freetype.vcxproj: Further improvements.
 
+2017-09-23  Werner Lemberg  <[email protected]>
+
+	[otvalid] Update common table handling to OpenType 1.8.2.
+
+	* src/otvalid/otvcommn.c (otv_Device_validate): Handle
+	VariationIndex subtable.
+	(otv_Lookup_validate): Handle MarkFilteringSet.
+
 2017-09-23  Ben Wagner  <[email protected]>
 
 	[truetype] Really fix #52082.
--- a/src/otvalid/otvcommn.c
+++ b/src/otvalid/otvcommn.c
@@ -313,19 +313,26 @@
 
     OTV_NAME_ENTER( "Device" );
 
-    OTV_LIMIT_CHECK( 8 );
+    OTV_LIMIT_CHECK( 6 );
     StartSize   = FT_NEXT_USHORT( p );
     EndSize     = FT_NEXT_USHORT( p );
     DeltaFormat = FT_NEXT_USHORT( p );
 
-    if ( DeltaFormat < 1 || DeltaFormat > 3 )
-      FT_INVALID_FORMAT;
+    if ( DeltaFormat == 0x8000U )
+    {
+      /* VariationIndex, nothing to do */
+    }
+    else
+    {
+      if ( DeltaFormat < 1 || DeltaFormat > 3 )
+        FT_INVALID_FORMAT;
 
-    if ( EndSize < StartSize )
-      FT_INVALID_DATA;
+      if ( EndSize < StartSize )
+        FT_INVALID_DATA;
 
-    count = EndSize - StartSize + 1;
-    OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 );  /* DeltaValue */
+      count = EndSize - StartSize + 1;
+      OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 );  /* DeltaValue */
+    }
 
     OTV_EXIT;
   }
@@ -347,7 +354,7 @@
                        OTV_Validator  otvalid )
   {
     FT_Bytes           p = table;
-    FT_UInt            LookupType, SubTableCount;
+    FT_UInt            LookupType, LookupFlag, SubTableCount;
     OTV_Validate_Func  validate;
 
 
@@ -355,7 +362,7 @@
 
     OTV_LIMIT_CHECK( 6 );
     LookupType    = FT_NEXT_USHORT( p );
-    p            += 2;                      /* skip LookupFlag */
+    LookupFlag    = FT_NEXT_USHORT( p );
     SubTableCount = FT_NEXT_USHORT( p );
 
     OTV_TRACE(( " (type %d)\n", LookupType ));
@@ -372,6 +379,9 @@
     /* SubTable */
     for ( ; SubTableCount > 0; SubTableCount-- )
       validate( table + FT_NEXT_USHORT( p ), otvalid );
+
+    if ( LookupFlag & 0x10 )
+      OTV_LIMIT_CHECK( 2 );  /* MarkFilteringSet */
 
     OTV_EXIT;
   }