From 1ee02cd0419021c3d4950af2619da39c6e9c47f0 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 21 Dec 2009 15:22:51 +0000 Subject: Updated to freetype-2.3.11 --- freetype/src/otvalid/otvcommn.h | 44 ++++++++++++++++++++--------------------- freetype/src/otvalid/otvgpos.c | 5 +++-- freetype/src/otvalid/otvgsub.c | 3 ++- freetype/src/otvalid/otvmod.c | 23 ++++++++++++++++----- freetype/src/otvalid/otvmod.h | 4 ++++ 5 files changed, 49 insertions(+), 30 deletions(-) (limited to 'freetype/src/otvalid') diff --git a/freetype/src/otvalid/otvcommn.h b/freetype/src/otvalid/otvcommn.h index 71726d5b2..898887fc9 100644 --- a/freetype/src/otvalid/otvcommn.h +++ b/freetype/src/otvalid/otvcommn.h @@ -4,7 +4,7 @@ /* */ /* OpenType common tables validation (specification). */ /* */ -/* Copyright 2004, 2005, 2007 by */ +/* Copyright 2004, 2005, 2007, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -85,27 +85,27 @@ FT_BEGIN_HEADER FT_INVALID_TOO_SHORT; \ FT_END_STMNT -#define OTV_SIZE_CHECK( _size ) \ - FT_BEGIN_STMNT \ - if ( _size > 0 && _size < table_size ) \ - { \ - if ( valid->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'!\n" \ - "Set to zero.\n" \ - "\n", #_size )); \ - \ - /* always assume 16bit entities */ \ - _size = pp[0] = pp[1] = 0; \ - } \ - } \ +#define OTV_SIZE_CHECK( _size ) \ + FT_BEGIN_STMNT \ + if ( _size > 0 && _size < table_size ) \ + { \ + if ( valid->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 )); \ + \ + /* always assume 16bit entities */ \ + _size = pp[0] = pp[1] = 0; \ + } \ + } \ FT_END_STMNT diff --git a/freetype/src/otvalid/otvgpos.c b/freetype/src/otvalid/otvgpos.c index 53025ec5e..49b46183a 100644 --- a/freetype/src/otvalid/otvgpos.c +++ b/freetype/src/otvalid/otvgpos.c @@ -209,7 +209,7 @@ { if ( format & 1 ) { - FT_UInt table_size; + FT_PtrDist table_size; OTV_OPTIONAL_TABLE( device ); @@ -911,7 +911,8 @@ { case 1: /* ExtensionPosFormat1 */ { - FT_UInt ExtensionLookupType, ExtensionOffset; + FT_UInt ExtensionLookupType; + FT_ULong ExtensionOffset; OTV_Validate_Func validate; diff --git a/freetype/src/otvalid/otvgsub.c b/freetype/src/otvalid/otvgsub.c index f01fca1e8..ed499d1e9 100644 --- a/freetype/src/otvalid/otvgsub.c +++ b/freetype/src/otvalid/otvgsub.c @@ -415,7 +415,8 @@ { case 1: /* ExtensionSubstFormat1 */ { - FT_UInt ExtensionLookupType, ExtensionOffset; + FT_UInt ExtensionLookupType; + FT_ULong ExtensionOffset; OTV_Validate_Func validate; diff --git a/freetype/src/otvalid/otvmod.c b/freetype/src/otvalid/otvmod.c index 63c25f690..324856456 100644 --- a/freetype/src/otvalid/otvmod.c +++ b/freetype/src/otvalid/otvmod.c @@ -82,12 +82,25 @@ FT_Byte* volatile math; FT_ULong len_base, len_gdef, len_gpos, len_gsub, len_jstf; FT_ULong len_math; + FT_UInt num_glyphs = (FT_UInt)face->num_glyphs; FT_ValidatorRec volatile valid; base = gdef = gpos = gsub = jstf = math = NULL; len_base = len_gdef = len_gpos = len_gsub = len_jstf = len_math = 0; + /* + * XXX: OpenType tables cannot handle 32-bit glyph index, + * although broken TrueType can have 32-bit glyph index. + */ + if ( face->num_glyphs > 0xFFFFL ) + { + FT_TRACE1(( "otv_validate: Invalid glyphs index (0x0000FFFF - 0x%08x) ", + face->num_glyphs )); + FT_TRACE1(( "are not handled by OpenType tables\n" )); + num_glyphs = 0xFFFF; + } + /* load tables */ if ( ot_flags & FT_VALIDATE_BASE ) @@ -148,7 +161,7 @@ { ft_validator_init( &valid, gpos, gpos + len_gpos, FT_VALIDATE_DEFAULT ); if ( ft_setjmp( valid.jump_buffer ) == 0 ) - otv_GPOS_validate( gpos, face->num_glyphs, &valid ); + otv_GPOS_validate( gpos, num_glyphs, &valid ); error = valid.error; if ( error ) goto Exit; @@ -158,7 +171,7 @@ { ft_validator_init( &valid, gsub, gsub + len_gsub, FT_VALIDATE_DEFAULT ); if ( ft_setjmp( valid.jump_buffer ) == 0 ) - otv_GSUB_validate( gsub, face->num_glyphs, &valid ); + otv_GSUB_validate( gsub, num_glyphs, &valid ); error = valid.error; if ( error ) goto Exit; @@ -168,7 +181,7 @@ { ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT ); if ( ft_setjmp( valid.jump_buffer ) == 0 ) - otv_GDEF_validate( gdef, gsub, gpos, face->num_glyphs, &valid ); + otv_GDEF_validate( gdef, gsub, gpos, num_glyphs, &valid ); error = valid.error; if ( error ) goto Exit; @@ -178,7 +191,7 @@ { ft_validator_init( &valid, jstf, jstf + len_jstf, FT_VALIDATE_DEFAULT ); if ( ft_setjmp( valid.jump_buffer ) == 0 ) - otv_JSTF_validate( jstf, gsub, gpos, face->num_glyphs, &valid ); + otv_JSTF_validate( jstf, gsub, gpos, num_glyphs, &valid ); error = valid.error; if ( error ) goto Exit; @@ -188,7 +201,7 @@ { ft_validator_init( &valid, math, math + len_math, FT_VALIDATE_DEFAULT ); if ( ft_setjmp( valid.jump_buffer ) == 0 ) - otv_MATH_validate( math, face->num_glyphs, &valid ); + otv_MATH_validate( math, num_glyphs, &valid ); error = valid.error; if ( error ) goto Exit; diff --git a/freetype/src/otvalid/otvmod.h b/freetype/src/otvalid/otvmod.h index 1bfc1899f..573b2a0c4 100644 --- a/freetype/src/otvalid/otvmod.h +++ b/freetype/src/otvalid/otvmod.h @@ -27,6 +27,10 @@ FT_BEGIN_HEADER +#ifdef FT_CONFIG_OPTION_PIC +#error "this module does not support PIC yet" +#endif + FT_EXPORT_VAR( const FT_Module_Class ) otv_module_class; -- cgit v1.2.3