From 75b91a49aa6438abc60366e90970e2fee8923f74 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Wed, 15 Jun 2011 01:10:33 +0900 Subject: [PATCH] [gxvalid] Cleanup. Some invalid, overrunning, unrecommended non-zero values are cared in paranoid validation mode only. There are many lines looking like: if ( valid->root->level >= FT_VALIDATE_PARANOID ) FT_INVALID_xxx; To simplify them, GXV_SET_ERR_IF_PARANOID( err ) is introduced for more paranoid validation in future. * src/gxvalid/gxvcommn.h (IS_PARANOID_VALIDATION): New macro to assure valid->root->level is more or equal to FT_VALIDATE_PARANOID. (GXV_SET_ERR_IF_PARANOID): New macro to raise an error if in paranoid validation. * src/gxvalid/gxvcommn.c: Use GXV_SET_ERR_IF_PARANOID(). * src/gxvalid/gxvfeat.c: Ditto. * src/gxvalid/gxvjust.c: Ditto. * src/gxvalid/gxvkern.c: Ditto. * src/gxvalid/gxvmort.c: Ditto. * src/gxvalid/gxvmort0.c: Ditto. * src/gxvalid/gxvmort1.c: Ditto. * src/gxvalid/gxvmort2.c: Ditto. * src/gxvalid/gxvmorx1.c: Ditto. * src/gxvalid/gxvmorx2.c: Ditto. --- ChangeLog | 29 +++++++++++++++++++++++++++ src/gxvalid/gxvcommn.c | 45 ++++++++++++++---------------------------- src/gxvalid/gxvcommn.h | 2 ++ src/gxvalid/gxvfeat.c | 25 ++++++++++------------- src/gxvalid/gxvjust.c | 20 ++++++++----------- src/gxvalid/gxvkern.c | 3 +-- src/gxvalid/gxvmort.c | 9 +++------ src/gxvalid/gxvmort0.c | 9 +++------ src/gxvalid/gxvmort1.c | 6 ++---- src/gxvalid/gxvmort2.c | 17 ++++++---------- src/gxvalid/gxvmorx1.c | 3 +-- src/gxvalid/gxvmorx2.c | 14 +++++-------- 12 files changed, 85 insertions(+), 97 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2cca2058..846bd3002 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2011-06-14 suzuki toshiya + + [gxvalid] Cleanup. + + Some invalid, overrunning, unrecommended non-zero values + are cared in paranoid validation mode only. There are + many lines looking like: + + if ( valid->root->level >= FT_VALIDATE_PARANOID ) + FT_INVALID_xxx; + + To simplify them, GXV_SET_ERR_IF_PARANOID( err ) is + introduced for more paranoid validation in future. + + * src/gxvalid/gxvcommn.h (IS_PARANOID_VALIDATION): + New macro to assure valid->root->level is more or + equal to FT_VALIDATE_PARANOID. (GXV_SET_ERR_IF_PARANOID): + New macro to raise an error if in paranoid validation. + * src/gxvalid/gxvcommn.c: Use GXV_SET_ERR_IF_PARANOID(). + * src/gxvalid/gxvfeat.c: Ditto. + * src/gxvalid/gxvjust.c: Ditto. + * src/gxvalid/gxvkern.c: Ditto. + * src/gxvalid/gxvmort.c: Ditto. + * src/gxvalid/gxvmort0.c: Ditto. + * src/gxvalid/gxvmort1.c: Ditto. + * src/gxvalid/gxvmort2.c: Ditto. + * src/gxvalid/gxvmorx1.c: Ditto. + * src/gxvalid/gxvmorx2.c: Ditto. + 2011-06-14 suzuki toshiya [gxvalid] Fix gcc4.6 compiler warnings in gxvtrak.c. diff --git a/src/gxvalid/gxvcommn.c b/src/gxvalid/gxvcommn.c index 211f97201..d3c48d4ea 100644 --- a/src/gxvalid/gxvcommn.c +++ b/src/gxvalid/gxvcommn.c @@ -304,8 +304,7 @@ binSrchHeader->unitSize, binSrchHeader->nUnits, searchRange, entrySelector, rangeShift )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } } @@ -442,8 +441,7 @@ { GXV_TRACE(( "too short, glyphs %d - %d are missing\n", i, valid->face->num_glyphs )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); break; } @@ -531,8 +529,7 @@ GXV_TRACE(( "reverse ordered segment specification:" " lastGlyph[%d]=%d < lastGlyph[%d]=%d\n", unit, lastGlyph, unit - 1 , gid )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } if ( lastGlyph < firstGlyph ) @@ -540,8 +537,7 @@ GXV_TRACE(( "reverse ordered range specification at unit %d:", " lastGlyph %d < firstGlyph %d ", unit, lastGlyph, firstGlyph )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); if ( valid->root->level == FT_VALIDATE_TIGHT ) continue; /* ftxvalidator silently skips such an entry */ @@ -604,8 +600,7 @@ GXV_TRACE(( "reverse ordered segment specification:" " lastGlyph[%d]=%d < lastGlyph[%d]=%d\n", unit, lastGlyph, unit - 1 , gid )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } if ( lastGlyph < firstGlyph ) @@ -613,8 +608,7 @@ GXV_TRACE(( "reverse ordered range specification at unit %d:", " lastGlyph %d < firstGlyph %d ", unit, lastGlyph, firstGlyph )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); if ( valid->root->level == FT_VALIDATE_TIGHT ) continue; /* ftxvalidator silently skips such an entry */ @@ -705,8 +699,7 @@ { GXV_TRACE(( "current gid 0x%04x < previous gid 0x%04x\n", glyph, prev_glyph )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } prev_glyph = glyph; @@ -834,8 +827,7 @@ { GXV_TRACE(( " gxv_glyphid_check() gid overflow: num_glyphs %d < %d\n", face->num_glyphs, gid )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } return 0; @@ -1101,8 +1093,7 @@ if ( ( maxEntry + 1 ) * entrySize > *length_p ) { - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_TOO_SHORT; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_TOO_SHORT ); /* ftxvalidator and FontValidator both warn and continue */ maxEntry = (FT_Byte)( *length_p / entrySize - 1 ); @@ -1126,8 +1117,7 @@ { GXV_TRACE(( " newState offset 0x%04x is out of stateArray\n", newState )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); continue; } @@ -1135,8 +1125,7 @@ { GXV_TRACE(( " newState offset 0x%04x is not aligned to %d-classes\n", newState, 1 + maxClassID )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); continue; } @@ -1173,8 +1162,7 @@ break; default: - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_FORMAT; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT ); goto Exit; } @@ -1503,8 +1491,7 @@ { GXV_TRACE(( " newState index 0x%04x points out of stateArray\n", newState_idx )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } state = (FT_UShort)( newState_idx / ( 1 + maxClassID ) ); @@ -1513,8 +1500,7 @@ FT_TRACE4(( "-> new state = %d (supposed)\n" "but newState index 0x%04x is not aligned to %d-classes\n", state, newState_idx, 1 + maxClassID )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } switch ( GXV_GLYPHOFFSET_FMT( xstatetable ) ) @@ -1548,8 +1534,7 @@ break; default: - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_FORMAT; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT ); goto Exit; } diff --git a/src/gxvalid/gxvcommn.h b/src/gxvalid/gxvcommn.h index 7dee79255..35c043dbd 100644 --- a/src/gxvalid/gxvcommn.h +++ b/src/gxvalid/gxvcommn.h @@ -61,6 +61,8 @@ FT_BEGIN_HEADER #undef GXV_LOAD_UNUSED_VARS /* debug purpose */ +#define IS_PARANOID_VALIDATION ( valid->root->level >= FT_VALIDATE_PARANOID ) +#define GXV_SET_ERR_IF_PARANOID( err ) { if ( IS_PARANOID_VALIDATION ) ( err ); } /*************************************************************************/ /*************************************************************************/ diff --git a/src/gxvalid/gxvfeat.c b/src/gxvalid/gxvfeat.c index 002fec6d6..46792bbf9 100644 --- a/src/gxvalid/gxvfeat.c +++ b/src/gxvalid/gxvfeat.c @@ -92,8 +92,7 @@ { GXV_TRACE(( "feature number %d is out of range %d\n", feature, gxv_feat_registry_length )); - if ( valid->root->level == FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); goto Exit; } @@ -101,8 +100,7 @@ { GXV_TRACE(( "feature number %d is in defined range but doesn't exist\n", feature )); - if ( valid->root->level == FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); goto Exit; } @@ -222,9 +220,8 @@ if ( settingTable < reserved_size ) FT_INVALID_OFFSET; - if ( valid->root->level == FT_VALIDATE_PARANOID && - ( featureFlags & GXV_FEAT_MASK_UNUSED ) == 0 ) - FT_INVALID_DATA; + if ( ( featureFlags & GXV_FEAT_MASK_UNUSED ) == 0 ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); exclusive = FT_BOOL( featureFlags & GXV_FEAT_MASK_EXCLUSIVE_SETTINGS ); if ( exclusive ) @@ -252,9 +249,8 @@ { gxv_feat_setting_validate( p, limit, exclusive, valid ); - if ( valid->root->level == FT_VALIDATE_PARANOID && - (FT_Int)GXV_FEAT_DATA( setting ) <= last_setting ) - FT_INVALID_FORMAT; + if ( (FT_Int)GXV_FEAT_DATA( setting ) <= last_setting ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT ); last_setting = (FT_Int)GXV_FEAT_DATA( setting ); /* setting + nameIndex */ @@ -312,8 +308,8 @@ featureNameCount = FT_NEXT_USHORT( p ); GXV_TRACE(( " (featureNameCount = %d)\n", featureNameCount )); - if ( valid->root->level != FT_VALIDATE_PARANOID ) - p += 6; /* skip (none) and (none) */ + if ( !( IS_PARANOID_VALIDATION ) ) + p += 6; /* skip (none) and (none) */ else { if ( FT_NEXT_USHORT( p ) != 0 ) @@ -329,9 +325,8 @@ { gxv_feat_name_validate( p, limit, valid ); - if ( valid->root->level == FT_VALIDATE_PARANOID && - (FT_Int)GXV_FEAT_DATA( feature ) <= last_feature ) - FT_INVALID_FORMAT; + if ( (FT_Int)GXV_FEAT_DATA( feature ) <= last_feature ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT ); last_feature = GXV_FEAT_DATA( feature ); p += 2 + 2 + 4 + 2 + 2; diff --git a/src/gxvalid/gxvjust.c b/src/gxvalid/gxvjust.c index ed4f1e9bd..7816e0b7f 100644 --- a/src/gxvalid/gxvjust.c +++ b/src/gxvalid/gxvjust.c @@ -77,8 +77,7 @@ GXV_TRACE(( "just table includes too large %s" " GID=%d > %d (in maxp)\n", msg_tag, gid, valid->face->num_glyphs )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } @@ -113,13 +112,12 @@ #endif /* According to Apple spec, only 7bits in justClass is used */ - if ( valid->root->level >= FT_VALIDATE_PARANOID && - ( justClass & 0xFFFFFF80 ) != 0 ) + if ( ( justClass & 0xFFFFFF80 ) != 0 ) { GXV_TRACE(( "just table includes non-zero value" " in unused justClass higher bits" " of WidthDeltaPair" )); - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } valid->subtable_length = p - table; @@ -202,12 +200,11 @@ #endif decomposedCount = FT_NEXT_USHORT( p ); - if ( valid->root->level >= FT_VALIDATE_PARANOID && - lowerLimit >= upperLimit ) + if ( lowerLimit >= upperLimit ) { GXV_TRACE(( "just table includes invalid range spec:" " lowerLimit(%d) > upperLimit(%d)\n" )); - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } for ( i = 0; i < decomposedCount; i++ ) @@ -303,7 +300,7 @@ else if ( noStretchValue > maximumLimit ) GXV_TRACE(( "type4:noStretchValue 0x%08x > maximumLimit 0x%08x\n", noStretchValue, maximumLimit )); - else if ( valid->root->level < FT_VALIDATE_PARANOID ) + else if ( !IS_PARANOID_VALIDATION ) return; FT_INVALID_DATA; @@ -353,9 +350,8 @@ actionLength = FT_NEXT_ULONG( p ); /* actionClass is related with justClass using 7bit only */ - if ( valid->root->level >= FT_VALIDATE_PARANOID && - ( actionClass & 0xFF80 ) != 0 ) - FT_INVALID_DATA; + if ( ( actionClass & 0xFF80 ) != 0 ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); if ( actionType == 0 ) gxv_just_actSubrecord_type0_validate( p, limit, valid ); diff --git a/src/gxvalid/gxvkern.c b/src/gxvalid/gxvkern.c index 8a4f30de5..0ec978f7b 100644 --- a/src/gxvalid/gxvkern.c +++ b/src/gxvalid/gxvkern.c @@ -491,8 +491,7 @@ { GXV_TRACE(( "maxGID=%d, but glyphCount=%d\n", valid->face->num_glyphs, glyphCount )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } if ( flags != 0 ) diff --git a/src/gxvalid/gxvmort.c b/src/gxvalid/gxvmort.c index 50393b978..465462a05 100644 --- a/src/gxvalid/gxvmort.c +++ b/src/gxvalid/gxvmort.c @@ -47,16 +47,14 @@ GXV_TRACE(( "featureType %d is out of registered range, " "setting %d is unchecked\n", f->featureType, f->featureSetting )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } else if ( !gxv_feat_registry[f->featureType].existence ) { GXV_TRACE(( "featureType %d is within registered area " "but undefined, setting %d is unchecked\n", f->featureType, f->featureSetting )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } else { @@ -74,8 +72,7 @@ if ( f->featureSetting > nSettings_max ) { GXV_TRACE(( "out of defined range %d", nSettings_max )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } GXV_TRACE(( "\n" )); } diff --git a/src/gxvalid/gxvmort0.c b/src/gxvalid/gxvmort0.c index 65606ad38..b136ceda2 100644 --- a/src/gxvalid/gxvmort0.c +++ b/src/gxvalid/gxvmort0.c @@ -102,23 +102,20 @@ { GXV_TRACE(( " [odd] a glyph is marked as the first and last" " in Indic rearrangement\n" )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } if ( markFirst > 0 && dontAdvance > 0 ) { GXV_TRACE(( " [odd] the first glyph is marked as dontAdvance" " in Indic rearrangement\n" )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } if ( 0 < reserved ) { GXV_TRACE(( " non-zero bits found in reserved range\n" )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } else GXV_TRACE(( "\n" )); diff --git a/src/gxvalid/gxvmort1.c b/src/gxvalid/gxvmort1.c index 512f6a9c7..1c17a5d92 100644 --- a/src/gxvalid/gxvmort1.c +++ b/src/gxvalid/gxvmort1.c @@ -163,8 +163,7 @@ if ( 0 < reserved ) { GXV_TRACE(( " non-zero bits found in reserved range\n" )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } gxv_mort_subtable_type1_offset_to_subst_validate( markOffset, @@ -208,8 +207,7 @@ GXV_TRACE(( "substTable include a strange gid[%d]=%d >" " out of define range (%d..%d)\n", i, dst_gid, valid->min_gid, valid->max_gid )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } } diff --git a/src/gxvalid/gxvmort2.c b/src/gxvalid/gxvmort2.c index 97a1f60ae..9e08fb792 100644 --- a/src/gxvalid/gxvmort2.c +++ b/src/gxvalid/gxvmort2.c @@ -155,8 +155,7 @@ ligActionOffset, lat_base - p )); /* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */ - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } else if ( lat_limit < p ) { @@ -164,8 +163,7 @@ ligActionOffset, p - lat_limit )); /* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */ - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } else { @@ -192,8 +190,7 @@ " 2 x offset < ligatureTable (%d byte rewind)\n", offset, optdata->ligatureTable - offset * 2 )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } else if ( offset * 2 > optdata->ligatureTable + optdata->ligatureTable_length ) { @@ -204,8 +201,7 @@ optdata->ligatureTable + optdata->ligatureTable_length - offset * 2 )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } } } @@ -268,9 +264,8 @@ GXV_LIMIT_CHECK( 2 ); lig_gid = FT_NEXT_USHORT( p ); - if ( valid->root->level >= FT_VALIDATE_PARANOID && - valid->face->num_glyphs < lig_gid ) - FT_INVALID_GLYPH_ID; + if ( valid->face->num_glyphs < lig_gid ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } } GXV_EXIT; diff --git a/src/gxvalid/gxvmorx1.c b/src/gxvalid/gxvmorx1.c index 337e29709..ce0009a16 100644 --- a/src/gxvalid/gxvmorx1.c +++ b/src/gxvalid/gxvmorx1.c @@ -140,8 +140,7 @@ if ( 0 < reserved ) { GXV_TRACE(( " non-zero bits found in reserved range\n" )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } GXV_TRACE(( "markIndex = %d, currentIndex = %d\n", diff --git a/src/gxvalid/gxvmorx2.c b/src/gxvalid/gxvmorx2.c index feec66c84..bc18c6b8a 100644 --- a/src/gxvalid/gxvmorx2.c +++ b/src/gxvalid/gxvmorx2.c @@ -194,8 +194,7 @@ " too negative offset moving all GID" " below defined range: 0x%04x\n", offset & 0xFFFFU )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } else if ( ( offset & 0x3FFF0000UL ) == 0x0000000UL ) { @@ -206,15 +205,13 @@ " too large offset moving all GID" " over defined range: 0x%04x\n", offset & 0xFFFFU )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } GXV_TRACE(( "ligature action table includes" " invalid offset to add to 16-bit GID:" " 0x%08x\n", offset )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } } @@ -282,9 +279,8 @@ GXV_LIMIT_CHECK( 2 ); lig_gid = FT_NEXT_USHORT( p ); - if ( valid->root->level >= FT_VALIDATE_PARANOID && - lig_gid < valid->face->num_glyphs ) - FT_INVALID_GLYPH_ID; + if ( lig_gid < valid->face->num_glyphs ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } }