From 332064c92a01296b5dd2d25524d0f8286ccdd107 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Tue, 9 Jan 2018 06:16:46 +0000 Subject: freetype 2.9.0 git-svn-id: svn://tug.org/texlive/trunk@46256 c570f23f-e606-0410-a88d-b1316a301751 --- .../freetype2/freetype-src/src/otvalid/Jamfile | 2 +- .../freetype2/freetype-src/src/otvalid/module.mk | 2 +- .../freetype2/freetype-src/src/otvalid/otvalid.c | 2 +- .../freetype2/freetype-src/src/otvalid/otvalid.h | 2 +- .../freetype2/freetype-src/src/otvalid/otvbase.c | 35 ++++++- .../freetype2/freetype-src/src/otvalid/otvcommn.c | 30 ++++-- .../freetype2/freetype-src/src/otvalid/otvcommn.h | 54 +++++++--- .../freetype2/freetype-src/src/otvalid/otverror.h | 2 +- .../freetype2/freetype-src/src/otvalid/otvgdef.c | 113 +++++++++++++++++---- .../freetype2/freetype-src/src/otvalid/otvgpos.c | 56 +++++++--- .../freetype2/freetype-src/src/otvalid/otvgpos.h | 2 +- .../freetype2/freetype-src/src/otvalid/otvgsub.c | 36 ++++++- .../freetype2/freetype-src/src/otvalid/otvjstf.c | 2 +- .../freetype2/freetype-src/src/otvalid/otvmath.c | 2 +- .../freetype2/freetype-src/src/otvalid/otvmod.c | 2 +- .../freetype2/freetype-src/src/otvalid/otvmod.h | 2 +- .../freetype2/freetype-src/src/otvalid/rules.mk | 2 +- 17 files changed, 276 insertions(+), 70 deletions(-) (limited to 'Build/source/libs/freetype2/freetype-src/src/otvalid') diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/Jamfile b/Build/source/libs/freetype2/freetype-src/src/otvalid/Jamfile index a755f2bcfe6..21b8e0cb0f6 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/Jamfile +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/otvalid Jamfile # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk b/Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk index 5ee1265db81..34f3dab32f0 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/module.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c index 312751a1f48..4423ca10128 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.c @@ -4,7 +4,7 @@ /* */ /* FreeType validator for OpenType tables (body only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h index f2969ccccca..d7801abae50 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvalid.h @@ -4,7 +4,7 @@ /* */ /* OpenType table validation (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c index 3adad8439c7..a01d45c707a 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvbase.c @@ -4,7 +4,7 @@ /* */ /* OpenType BASE table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -284,22 +284,41 @@ OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; FT_UInt table_size; + FT_UShort version; OTV_OPTIONAL_TABLE( HorizAxis ); OTV_OPTIONAL_TABLE( VertAxis ); + OTV_OPTIONAL_TABLE32( itemVarStore ); + otvalid->root = ftvalid; FT_TRACE3(( "validating BASE table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 6 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; - table_size = 6; + version = FT_NEXT_USHORT( p ); /* minorVersion */ + + table_size = 8; + switch ( version ) + { + case 0: + OTV_LIMIT_CHECK( 4 ); + break; + + case 1: + OTV_LIMIT_CHECK( 8 ); + table_size += 4; + break; + + default: + FT_INVALID_FORMAT; + } OTV_OPTIONAL_OFFSET( HorizAxis ); OTV_SIZE_CHECK( HorizAxis ); @@ -311,6 +330,14 @@ if ( VertAxis ) otv_Axis_validate( table + VertAxis, otvalid ); + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET32( itemVarStore ); + OTV_SIZE_CHECK32( itemVarStore ); + if ( itemVarStore ) + OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c index 3407d2ad4ab..0ccfb03c08a 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.c @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -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 )); @@ -373,6 +380,9 @@ for ( ; SubTableCount > 0; SubTableCount-- ) validate( table + FT_NEXT_USHORT( p ), otvalid ); + if ( LookupFlag & 0x10 ) + OTV_LIMIT_CHECK( 2 ); /* MarkFilteringSet */ + OTV_EXIT; } diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h index 10a603ebb93..a392784cf19 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -67,29 +67,38 @@ FT_BEGIN_HEADER #undef FT_INVALID_ -#define FT_INVALID_( _error ) \ +#define FT_INVALID_( _error ) \ ft_validator_error( otvalid->root, FT_THROW( _error ) ) #define OTV_OPTIONAL_TABLE( _table ) FT_UShort _table; \ FT_Bytes _table ## _p +#define OTV_OPTIONAL_TABLE32( _table ) FT_ULong _table; \ + FT_Bytes _table ## _p + #define OTV_OPTIONAL_OFFSET( _offset ) \ FT_BEGIN_STMNT \ _offset ## _p = p; \ _offset = FT_NEXT_USHORT( p ); \ FT_END_STMNT -#define OTV_LIMIT_CHECK( _count ) \ - FT_BEGIN_STMNT \ +#define OTV_OPTIONAL_OFFSET32( _offset ) \ + FT_BEGIN_STMNT \ + _offset ## _p = p; \ + _offset = FT_NEXT_ULONG( p ); \ + FT_END_STMNT + +#define OTV_LIMIT_CHECK( _count ) \ + FT_BEGIN_STMNT \ if ( p + (_count) > otvalid->root->limit ) \ - FT_INVALID_TOO_SHORT; \ + FT_INVALID_TOO_SHORT; \ FT_END_STMNT #define OTV_SIZE_CHECK( _size ) \ FT_BEGIN_STMNT \ if ( _size > 0 && _size < table_size ) \ { \ - if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ + if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ FT_INVALID_OFFSET; \ else \ { \ @@ -102,12 +111,33 @@ FT_BEGIN_HEADER " set to zero.\n" \ "\n", #_size )); \ \ - /* always assume 16bit entities */ \ _size = pp[0] = pp[1] = 0; \ } \ } \ FT_END_STMNT +#define OTV_SIZE_CHECK32( _size ) \ + FT_BEGIN_STMNT \ + if ( _size > 0 && _size < table_size ) \ + { \ + if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ + FT_INVALID_OFFSET; \ + else \ + { \ + /* strip off `const' */ \ + FT_Byte* pp = (FT_Byte*)_size ## _p; \ + \ + \ + FT_TRACE3(( "\n" \ + "Invalid offset to optional table `%s'" \ + " set to zero.\n" \ + "\n", #_size )); \ + \ + _size = pp[0] = pp[1] = pp[2] = pp[3] = 0; \ + } \ + } \ + FT_END_STMNT + #define OTV_NAME_(x) #x #define OTV_NAME(x) OTV_NAME_(x) @@ -146,11 +176,11 @@ FT_BEGIN_HEADER #define OTV_INIT otvalid->debug_indent = 0 -#define OTV_ENTER \ - FT_BEGIN_STMNT \ - otvalid->debug_indent += 2; \ - FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ - FT_TRACE4(( "%s table\n", \ +#define OTV_ENTER \ + FT_BEGIN_STMNT \ + otvalid->debug_indent += 2; \ + FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ + FT_TRACE4(( "%s table\n", \ otvalid->debug_function_name[otvalid->nesting_level] )); \ FT_END_STMNT diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h index 699903987cc..2fcf42e3875 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otverror.h @@ -4,7 +4,7 @@ /* */ /* OpenType validation module error codes (specification only). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c index 27b9a69ca88..08f3171541f 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgdef.c @@ -4,7 +4,7 @@ /* */ /* OpenType GDEF table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -68,7 +68,7 @@ OTV_LIMIT_CHECK( GlyphCount * 2 ); otvalid->nesting_level++; - func = otvalid->func[otvalid->nesting_level]; + func = otvalid->func[otvalid->nesting_level]; otvalid->extra1 = 0; for ( ; GlyphCount > 0; GlyphCount-- ) @@ -133,6 +133,40 @@ } + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** MARK GLYPH SETS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + otv_MarkGlyphSets_validate( FT_Bytes table, + OTV_Validator otvalid ) + { + FT_Bytes p = table; + FT_UInt MarkGlyphSetCount; + + + OTV_NAME_ENTER( "MarkGlyphSets" ); + + p += 2; /* skip Format */ + + OTV_LIMIT_CHECK( 2 ); + MarkGlyphSetCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (MarkGlyphSetCount = %d)\n", MarkGlyphSetCount )); + + OTV_LIMIT_CHECK( MarkGlyphSetCount * 4 ); /* CoverageOffsets */ + + for ( ; MarkGlyphSetCount > 0; MarkGlyphSetCount-- ) + otv_Coverage_validate( table + FT_NEXT_ULONG( p ), otvalid, -1 ); + + OTV_EXIT; + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -152,14 +186,18 @@ { OTV_ValidatorRec otvalidrec; OTV_Validator otvalid = &otvalidrec; - FT_Bytes p = table; + FT_Bytes p = table; FT_UInt table_size; - FT_Bool need_MarkAttachClassDef; + FT_UShort version; + FT_Bool need_MarkAttachClassDef = 1; OTV_OPTIONAL_TABLE( GlyphClassDef ); OTV_OPTIONAL_TABLE( AttachListOffset ); OTV_OPTIONAL_TABLE( LigCaretListOffset ); OTV_OPTIONAL_TABLE( MarkAttachClassDef ); + OTV_OPTIONAL_TABLE( MarkGlyphSetsDef ); + + OTV_OPTIONAL_TABLE32( itemVarStore ); otvalid->root = ftvalid; @@ -167,24 +205,49 @@ FT_TRACE3(( "validating GDEF table\n" )); OTV_INIT; - OTV_LIMIT_CHECK( 12 ); + OTV_LIMIT_CHECK( 4 ); - if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; - /* MarkAttachClassDef has been added to the OpenType */ - /* specification without increasing GDEF's version, */ - /* so we use this ugly hack to find out whether the */ - /* table is needed actually. */ + version = FT_NEXT_USHORT( p ); /* minorVersion */ - need_MarkAttachClassDef = FT_BOOL( - otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || - otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); + table_size = 10; + switch ( version ) + { + case 0: + /* MarkAttachClassDef has been added to the OpenType */ + /* specification without increasing GDEF's version, */ + /* so we use this ugly hack to find out whether the */ + /* table is needed actually. */ + + need_MarkAttachClassDef = FT_BOOL( + otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || + otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); + + if ( need_MarkAttachClassDef ) + { + OTV_LIMIT_CHECK( 8 ); + table_size += 2; + } + else + OTV_LIMIT_CHECK( 6 ); /* OpenType < 1.2 */ - if ( need_MarkAttachClassDef ) - table_size = 12; /* OpenType >= 1.2 */ - else - table_size = 10; /* OpenType < 1.2 */ + break; + + case 2: + OTV_LIMIT_CHECK( 10 ); + table_size += 4; + break; + + case 3: + OTV_LIMIT_CHECK( 14 ); + table_size += 8; + break; + + default: + FT_INVALID_FORMAT; + } otvalid->glyph_count = glyph_count; @@ -217,6 +280,22 @@ otv_ClassDef_validate( table + MarkAttachClassDef, otvalid ); } + if ( version > 0 ) + { + OTV_OPTIONAL_OFFSET( MarkGlyphSetsDef ); + OTV_SIZE_CHECK( MarkGlyphSetsDef ); + if ( MarkGlyphSetsDef ) + otv_MarkGlyphSets_validate( table + MarkGlyphSetsDef, otvalid ); + } + + if ( version > 2 ) + { + OTV_OPTIONAL_OFFSET32( itemVarStore ); + OTV_SIZE_CHECK32( itemVarStore ); + if ( itemVarStore ) + OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */ + } + FT_TRACE4(( "\n" )); } diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c index 0fbcc2077cb..696b35cae62 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.c @@ -4,7 +4,7 @@ /* */ /* OpenType GPOS table validation (body). */ /* */ -/* Copyright 2002-2017 by */ +/* Copyright 2002-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -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 ); @@ -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 ); @@ -271,7 +267,7 @@ case 3: { - FT_UInt table_size; + FT_UInt table_size; OTV_OPTIONAL_TABLE( XDeviceTable ); OTV_OPTIONAL_TABLE( YDeviceTable ); @@ -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 */ @@ -537,7 +535,9 @@ otv_ClassDef_validate( table + ClassDef2, otvalid ); OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 * - ( len_value1 + len_value2 ) ); + ( len_value1 + len_value2 ) ); + + otvalid->extra3 = table; /* 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/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h index 99b0ad39159..95f9ac3ee85 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgpos.h @@ -4,7 +4,7 @@ /* */ /* OpenType GPOS table validator (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c index f9bd8dc5d80..d35ea67f309 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvgsub.c @@ -4,7 +4,7 @@ /* */ /* OpenType GSUB table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -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" )); } diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c index 57a38f95c9e..94d4af90f6f 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvjstf.c @@ -4,7 +4,7 @@ /* */ /* OpenType JSTF table validation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c index a14d3697008..b9800f60a26 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c @@ -4,7 +4,7 @@ /* */ /* OpenType MATH table validation (body). */ /* */ -/* Copyright 2007-2017 by */ +/* Copyright 2007-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* Written by George Williams. */ diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c index 35ffc43d3a5..89ee449d16d 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's OpenType validation module implementation (body). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h index 30d401ddca3..6917bccee5d 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.h @@ -5,7 +5,7 @@ /* FreeType's OpenType validation module implementation */ /* (specification). */ /* */ -/* Copyright 2004-2017 by */ +/* Copyright 2004-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk b/Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk index 10329a96ea0..d4fc7237405 100644 --- a/Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk +++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2004-2017 by +# Copyright 2004-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, -- cgit v1.2.3