freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 0da0faf 2/4: [otvalid] Handle `GSUB' and `GPOS' v1.1


From: Werner LEMBERG
Subject: [freetype2] master 0da0faf 2/4: [otvalid] Handle `GSUB' and `GPOS' v1.1 tables.
Date: Sun, 24 Sep 2017 03:17:00 -0400 (EDT)

branch: master
commit 0da0faf0fb14eda88cd0a14e41c6727f32e89ce9
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [otvalid] Handle `GSUB' and `GPOS' v1.1 tables.
    
    * src/otvalid/otvgsub.c (otv_GSUB_validate), src/otvalid/otvgpos.c
    (otv_GPOS_validate): Implement it.
---
 ChangeLog             |  7 +++++++
 src/otvalid/otvgpos.c | 42 ++++++++++++++++++++++++++++++++++++------
 src/otvalid/otvgsub.c | 34 ++++++++++++++++++++++++++++++++--
 3 files changed, 75 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf57a70..58b2fb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,13 @@
 
 2017-09-23  Werner Lemberg  <address@hidden>
 
+       [otvalid] Handle `GSUB' and `GPOS' v1.1 tables.
+
+       * src/otvalid/otvgsub.c (otv_GSUB_validate), src/otvalid/otvgpos.c
+       (otv_GPOS_validate): Implement it.
+
+2017-09-23  Werner Lemberg  <address@hidden>
+
        [otvalid] Update common table handling to OpenType 1.8.2.
 
        * src/otvalid/otvcommn.c (otv_Device_validate): Handle
diff --git a/src/otvalid/otvgpos.c b/src/otvalid/otvgpos.c
index 0fbcc20..8aede40 100644
--- a/src/otvalid/otvgpos.c
+++ b/src/otvalid/otvgpos.c
@@ -130,7 +130,7 @@
     otv_MarkArray_validate( table + Array1, otvalid );
 
     otvalid->nesting_level++;
-    func          = otvalid->func[otvalid->nesting_level];
+    func            = otvalid->func[otvalid->nesting_level];
     otvalid->extra1 = ClassCount;
 
     func( table + Array2, otvalid );
@@ -271,7 +271,7 @@
 
     case 3:
       {
-        FT_UInt   table_size;
+        FT_UInt  table_size;
 
         OTV_OPTIONAL_TABLE( XDeviceTable );
         OTV_OPTIONAL_TABLE( YDeviceTable );
@@ -537,7 +537,7 @@
         otv_ClassDef_validate( table + ClassDef2, otvalid );
 
         OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 *
-                     ( len_value1 + len_value2 ) );
+                         ( len_value1 + len_value2 ) );
 
         /* Class1Record */
         for ( ; ClassCount1 > 0; ClassCount1-- )
@@ -985,20 +985,42 @@
   {
     OTV_ValidatorRec  validrec;
     OTV_Validator     otvalid = &validrec;
-    FT_Bytes          p     = table;
+    FT_Bytes          p       = table;
+    FT_UInt           table_size;
+    FT_UShort         version;
     FT_UInt           ScriptList, FeatureList, LookupList;
 
+    OTV_OPTIONAL_TABLE32( featureVariations );
+
 
     otvalid->root = ftvalid;
 
     FT_TRACE3(( "validating GPOS table\n" ));
     OTV_INIT;
 
-    OTV_LIMIT_CHECK( 10 );
+    OTV_LIMIT_CHECK( 4 );
 
-    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
+    if ( FT_NEXT_USHORT( p ) != 1 )  /* majorVersion */
       FT_INVALID_FORMAT;
 
+    version = FT_NEXT_USHORT( p );   /* minorVersion */
+
+    table_size = 10;
+    switch ( version )
+    {
+    case 0:
+      OTV_LIMIT_CHECK( 6 );
+      break;
+
+    case 1:
+      OTV_LIMIT_CHECK( 10 );
+      table_size += 4;
+      break;
+
+    default:
+      FT_INVALID_FORMAT;
+    }
+
     ScriptList  = FT_NEXT_USHORT( p );
     FeatureList = FT_NEXT_USHORT( p );
     LookupList  = FT_NEXT_USHORT( p );
@@ -1014,6 +1036,14 @@
     otv_ScriptList_validate( table + ScriptList, table + FeatureList,
                              otvalid );
 
+    if ( version > 0 )
+    {
+      OTV_OPTIONAL_OFFSET32( featureVariations );
+      OTV_SIZE_CHECK32( featureVariations );
+      if ( featureVariations )
+        OTV_TRACE(( "  [omitting featureVariations validation]\n" )); /* XXX */
+    }
+
     FT_TRACE4(( "\n" ));
   }
 
diff --git a/src/otvalid/otvgsub.c b/src/otvalid/otvgsub.c
index f9bd8dc..3b58b6d 100644
--- a/src/otvalid/otvgsub.c
+++ b/src/otvalid/otvgsub.c
@@ -552,18 +552,40 @@
     OTV_ValidatorRec  otvalidrec;
     OTV_Validator     otvalid = &otvalidrec;
     FT_Bytes          p       = table;
+    FT_UInt           table_size;
+    FT_UShort         version;
     FT_UInt           ScriptList, FeatureList, LookupList;
 
+    OTV_OPTIONAL_TABLE32( featureVariations );
+
 
     otvalid->root = ftvalid;
 
     FT_TRACE3(( "validating GSUB table\n" ));
     OTV_INIT;
 
-    OTV_LIMIT_CHECK( 10 );
+    OTV_LIMIT_CHECK( 4 );
+
+    if ( FT_NEXT_USHORT( p ) != 1 )  /* majorVersion */
+      FT_INVALID_FORMAT;
+
+    version = FT_NEXT_USHORT( p );   /* minorVersion */
+
+    table_size = 10;
+    switch ( version )
+    {
+    case 0:
+      OTV_LIMIT_CHECK( 6 );
+      break;
+
+    case 1:
+      OTV_LIMIT_CHECK( 10 );
+      table_size += 4;
+      break;
 
-    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
+    default:
       FT_INVALID_FORMAT;
+    }
 
     ScriptList  = FT_NEXT_USHORT( p );
     FeatureList = FT_NEXT_USHORT( p );
@@ -580,6 +602,14 @@
     otv_ScriptList_validate( table + ScriptList, table + FeatureList,
                              otvalid );
 
+    if ( version > 0 )
+    {
+      OTV_OPTIONAL_OFFSET32( featureVariations );
+      OTV_SIZE_CHECK32( featureVariations );
+      if ( featureVariations )
+        OTV_TRACE(( "  [omitting featureVariations validation]\n" )); /* XXX */
+    }
+
     FT_TRACE4(( "\n" ));
   }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]