diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2021-08-29 03:23:39 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2021-08-29 03:23:39 +0000 |
commit | bbf1dbf0b3d1816a776bb343fe3d7053ded7edaa (patch) | |
tree | 2bec0223c338750826e348165a25ff886ff7af01 /Build/source/libs/freetype2/freetype-src/src/psaux | |
parent | 5003f15f368f1ae0e925f78bf482c98fe06e68ba (diff) |
freetype 2.11.0
git-svn-id: svn://tug.org/texlive/trunk@60354 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src/psaux')
24 files changed, 218 insertions, 89 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c index 2d6a0d9a121..0ad1760518e 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c @@ -4,7 +4,7 @@ * * AFM parser (body). * - * Copyright (C) 2006-2020 by + * Copyright (C) 2006-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -29,6 +29,16 @@ /************************************************************************** * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ +#undef FT_COMPONENT +#define FT_COMPONENT afmparse + + + /************************************************************************** + * * AFM_Stream * * The use of AFM_Stream is largely inspired by parseAFM.[ch] from t1lib. @@ -586,21 +596,39 @@ static FT_Error afm_parse_track_kern( AFM_Parser parser ) { - AFM_FontInfo fi = parser->FontInfo; + AFM_FontInfo fi = parser->FontInfo; + AFM_Stream stream = parser->stream; AFM_TrackKern tk; - char* key; - FT_Offset len; - int n = -1; - FT_Int tmp; + + char* key; + FT_Offset len; + int n = -1; + FT_Int tmp; if ( afm_parser_read_int( parser, &tmp ) ) goto Fail; if ( tmp < 0 ) + { + FT_ERROR(( "afm_parse_track_kern: invalid number of track kerns\n" )); goto Fail; + } fi->NumTrackKern = (FT_UInt)tmp; + FT_TRACE3(( "afm_parse_track_kern: %u track kern%s expected\n", + fi->NumTrackKern, + fi->NumTrackKern == 1 ? "" : "s" )); + + /* Rough sanity check: The minimum line length of the `TrackKern` */ + /* command is 20 characters (including the EOL character). */ + if ( (FT_ULong)( stream->limit - stream->cursor ) / 20 < + fi->NumTrackKern ) + { + FT_ERROR(( "afm_parse_track_kern:" + " number of track kern entries exceeds stream size\n" )); + goto Fail; + } if ( fi->NumTrackKern ) { @@ -623,7 +651,10 @@ n++; if ( n >= (int)fi->NumTrackKern ) - goto Fail; + { + FT_ERROR(( "afm_parse_track_kern: too many track kern data\n" )); + goto Fail; + } tk = fi->TrackKerns + n; @@ -633,7 +664,12 @@ shared_vals[3].type = AFM_VALUE_TYPE_FIXED; shared_vals[4].type = AFM_VALUE_TYPE_FIXED; if ( afm_parser_read_vals( parser, shared_vals, 5 ) != 5 ) + { + FT_ERROR(( "afm_parse_track_kern:" + " insufficient number of parameters for entry %d\n", + n )); goto Fail; + } tk->degree = shared_vals[0].u.i; tk->min_ptsize = shared_vals[1].u.f; @@ -646,7 +682,19 @@ case AFM_TOKEN_ENDTRACKKERN: case AFM_TOKEN_ENDKERNDATA: case AFM_TOKEN_ENDFONTMETRICS: - fi->NumTrackKern = (FT_UInt)( n + 1 ); + tmp = n + 1; + if ( (FT_UInt)tmp != fi->NumTrackKern ) + { + FT_TRACE1(( "afm_parse_track_kern: %s%d track kern entr%s seen\n", + tmp == 0 ? "" : "only ", + tmp, + tmp == 1 ? "y" : "ies" )); + fi->NumTrackKern = (FT_UInt)tmp; + } + else + FT_TRACE3(( "afm_parse_track_kern: %d track kern entr%s seen\n", + tmp, + tmp == 1 ? "y" : "ies" )); return FT_Err_Ok; case AFM_TOKEN_UNKNOWN: @@ -667,7 +715,7 @@ /* compare two kerning pairs */ - FT_CALLBACK_DEF( int ) + FT_COMPARE_DEF( int ) afm_compare_kern_pairs( const void* a, const void* b ) { @@ -690,7 +738,8 @@ static FT_Error afm_parse_kern_pairs( AFM_Parser parser ) { - AFM_FontInfo fi = parser->FontInfo; + AFM_FontInfo fi = parser->FontInfo; + AFM_Stream stream = parser->stream; AFM_KernPair kp; char* key; FT_Offset len; @@ -702,9 +751,26 @@ goto Fail; if ( tmp < 0 ) + { + FT_ERROR(( "afm_parse_kern_pairs: invalid number of kern pairs\n" )); goto Fail; + } fi->NumKernPair = (FT_UInt)tmp; + FT_TRACE3(( "afm_parse_kern_pairs: %u kern pair%s expected\n", + fi->NumKernPair, + fi->NumKernPair == 1 ? "" : "s" )); + + /* Rough sanity check: The minimum line length of the `KP`, */ + /* `KPH`,`KPX`, and `KPY` commands is 10 characters (including */ + /* the EOL character). */ + if ( (FT_ULong)( stream->limit - stream->cursor ) / 10 < + fi->NumKernPair ) + { + FT_ERROR(( "afm_parse_kern_pairs:" + " number of kern pairs exceeds stream size\n" )); + goto Fail; + } if ( fi->NumKernPair ) { @@ -734,7 +800,10 @@ n++; if ( n >= (int)fi->NumKernPair ) + { + FT_ERROR(( "afm_parse_kern_pairs: too many kern pairs\n" )); goto Fail; + } kp = fi->KernPairs + n; @@ -744,7 +813,12 @@ shared_vals[3].type = AFM_VALUE_TYPE_INTEGER; r = afm_parser_read_vals( parser, shared_vals, 4 ); if ( r < 3 ) + { + FT_ERROR(( "afm_parse_kern_pairs:" + " insufficient number of parameters for entry %d\n", + n )); goto Fail; + } /* index values can't be negative */ kp->index1 = shared_vals[0].u.u; @@ -766,7 +840,20 @@ case AFM_TOKEN_ENDKERNPAIRS: case AFM_TOKEN_ENDKERNDATA: case AFM_TOKEN_ENDFONTMETRICS: - fi->NumKernPair = (FT_UInt)( n + 1 ); + tmp = n + 1; + if ( (FT_UInt)tmp != fi->NumKernPair ) + { + FT_TRACE1(( "afm_parse_kern_pairs: %s%d kern pair%s seen\n", + tmp == 0 ? "" : "only ", + tmp, + tmp == 1 ? "" : "s" )); + fi->NumKernPair = (FT_UInt)tmp; + } + else + FT_TRACE3(( "afm_parse_kern_pairs: %d kern pair%s seen\n", + tmp, + tmp == 1 ? "" : "s" )); + ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ), afm_compare_kern_pairs ); @@ -792,22 +879,43 @@ char* key; FT_Offset len; + int have_trackkern = 0; + int have_kernpairs = 0; + while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 ) { switch ( afm_tokenize( key, len ) ) { case AFM_TOKEN_STARTTRACKKERN: + if ( have_trackkern ) + { + FT_ERROR(( "afm_parse_kern_data:" + " invalid second horizontal track kern section\n" )); + goto Fail; + } + error = afm_parse_track_kern( parser ); if ( error ) return error; + + have_trackkern = 1; break; case AFM_TOKEN_STARTKERNPAIRS: case AFM_TOKEN_STARTKERNPAIRS0: + if ( have_kernpairs ) + { + FT_ERROR(( "afm_parse_kern_data:" + " invalid second horizontal kern pair section\n" )); + goto Fail; + } + error = afm_parse_kern_pairs( parser ); if ( error ) return error; + + have_kernpairs = 1; break; case AFM_TOKEN_ENDKERNDATA: diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h index 16a3a3e902d..44b05b2cacb 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h @@ -4,7 +4,7 @@ * * AFM parser (specification). * - * Copyright (C) 2006-2020 by + * Copyright (C) 2006-2021 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/psaux/cffdecode.c b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c index 3d2da1e03ca..3498f670c79 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (body). * - * Copyright (C) 2017-2020 by + * Copyright (C) 2017-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -2153,7 +2153,7 @@ decoder->locals_bias ); - FT_TRACE4(( " callsubr (idx %d, entering level %d)\n", + FT_TRACE4(( " callsubr (idx %d, entering level %ld)\n", idx, zone - decoder->zones + 1 )); @@ -2197,7 +2197,7 @@ decoder->globals_bias ); - FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n", + FT_TRACE4(( " callgsubr (idx %d, entering level %ld)\n", idx, zone - decoder->zones + 1 )); @@ -2236,7 +2236,7 @@ break; case cff_op_return: - FT_TRACE4(( " return (leaving level %d)\n", + FT_TRACE4(( " return (leaving level %ld)\n", decoder->zone - decoder->zones )); if ( decoder->zone <= decoder->zones ) @@ -2271,7 +2271,8 @@ } /* while ip < limit */ - FT_TRACE4(( "..end..\n\n" )); + FT_TRACE4(( "..end..\n" )); + FT_TRACE4(( "\n" )); Fail: return error; diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h index 77a4962698b..b1314ed1c1e 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (specification). * - * Copyright (C) 2017-2020 by + * Copyright (C) 2017-2021 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/psaux/module.mk b/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk index 651db014263..06f7e72c1c9 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2020 by +# Copyright (C) 1996-2021 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/psaux/psarrst.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.c index 8751d275fb9..70313d283a4 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.c @@ -65,7 +65,6 @@ arrstack->error = error; arrstack->sizeItem = sizeItem; arrstack->allocated = 0; - arrstack->chunk = 10; /* chunks of 10 items */ arrstack->count = 0; arrstack->totalSize = 0; arrstack->ptr = NULL; @@ -110,7 +109,7 @@ FT_ASSERT( newSize > 0 ); /* avoid realloc with zero size */ - if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) ) + if ( !FT_QREALLOC( arrstack->ptr, arrstack->totalSize, newSize ) ) { arrstack->allocated = numElements; arrstack->totalSize = newSize; @@ -216,9 +215,9 @@ if ( arrstack->count == arrstack->allocated ) { - /* grow the buffer by one chunk */ + /* increase the buffer size */ if ( !cf2_arrstack_setNumElements( - arrstack, arrstack->allocated + arrstack->chunk ) ) + arrstack, arrstack->allocated * 2 + 16 ) ) { /* on error, ignore the push */ return; diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h index 098617b2575..31e5330cc38 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psarrst.h @@ -55,7 +55,6 @@ FT_BEGIN_HEADER size_t sizeItem; /* bytes per element */ size_t allocated; /* items allocated */ - size_t chunk; /* allocation increment in items */ size_t count; /* number of elements allocated */ size_t totalSize; /* total bytes allocated */ diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c index f4282222a68..2960c8b696b 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript driver component (body only). * - * Copyright (C) 1996-2020 by + * Copyright (C) 1996-2021 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/psaux/psauxerr.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h index 8b9a958aec0..e8ee29166cf 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ * * PS auxiliary module error codes (specification only). * - * Copyright (C) 2001-2020 by + * Copyright (C) 2001-2021 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/psaux/psauxmod.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c index e73ba224517..52da23365ed 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (body). * - * Copyright (C) 2000-2020 by + * Copyright (C) 2000-2021 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/psaux/psauxmod.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h index a6bebe4b945..e3e80632206 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (specification). * - * Copyright (C) 2000-2020 by + * Copyright (C) 2000-2021 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/psaux/psblues.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psblues.c index 3878e9bde04..f9c864fea9a 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psblues.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psblues.c @@ -506,7 +506,8 @@ /* guarantee minimum of 1 pixel overshoot */ dsNew = FT_MIN( cf2_fixedRound( bottomHintEdge->dsCoord ), - blues->zone[i].dsFlatEdge - cf2_intToFixed( 1 ) ); + SUB_INT32( blues->zone[i].dsFlatEdge, + cf2_intToFixed( 1 ) ) ); } else diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c index 4cf5cd5d881..c28d65df297 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c @@ -4,7 +4,7 @@ * * Some convenience conversions (body). * - * Copyright (C) 2006-2020 by + * Copyright (C) 2006-2021 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/psaux/psconv.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h index 833e8273648..cd91a7bb563 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h @@ -4,7 +4,7 @@ * * Some convenience conversions (specification). * - * Copyright (C) 2006-2020 by + * Copyright (C) 2006-2021 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/psaux/pshints.c b/Build/source/libs/freetype2/freetype-src/src/psaux/pshints.c index ce8cfca7154..ad472c98df5 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/pshints.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/pshints.c @@ -412,6 +412,12 @@ { FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] ); + /* final amount to move edge or edge pair */ + CF2_Fixed move = 0; + + CF2_Fixed dsCoord_i; + CF2_Fixed dsCoord_j; + /* index of upper edge (same value for ghost hint) */ j = isPair ? i + 1 : i; @@ -422,11 +428,14 @@ FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) == cf2_hint_isLocked( &hintmap->edge[j] ) ); + dsCoord_i = hintmap->edge[i].dsCoord; + dsCoord_j = hintmap->edge[j].dsCoord; + if ( !cf2_hint_isLocked( &hintmap->edge[i] ) ) { /* hint edge is not locked, we can adjust it */ - CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord ); - CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord ); + CF2_Fixed fracDown = cf2_fixedFraction( dsCoord_i ); + CF2_Fixed fracUp = cf2_fixedFraction( dsCoord_j ); /* calculate all four possibilities; moves down are negative */ CF2_Fixed downMoveDown = 0 - fracDown; @@ -443,9 +452,6 @@ /* smallest move down */ CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown ); - /* final amount to move edge or edge pair */ - CF2_Fixed move; - CF2_Fixed downMinCounter = CF2_MIN_COUNTER; CF2_Fixed upMinCounter = CF2_MIN_COUNTER; FT_Bool saveEdge = FALSE; @@ -467,16 +473,14 @@ /* is there room to move up? */ /* there is if we are at top of array or the next edge is at or */ /* beyond proposed move up? */ - if ( j >= hintmap->count - 1 || + if ( j >= hintmap->count - 1 || hintmap->edge[j + 1].dsCoord >= - ADD_INT32( hintmap->edge[j].dsCoord, - moveUp + upMinCounter ) ) + ADD_INT32( dsCoord_j, moveUp + upMinCounter ) ) { /* there is room to move up; is there also room to move down? */ - if ( i == 0 || + if ( i == 0 || hintmap->edge[i - 1].dsCoord <= - ADD_INT32( hintmap->edge[i].dsCoord, - moveDown - downMinCounter ) ) + ADD_INT32( dsCoord_i, moveDown - downMinCounter ) ) { /* move smaller absolute amount */ move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */ @@ -487,10 +491,9 @@ else { /* is there room to move down? */ - if ( i == 0 || + if ( i == 0 || hintmap->edge[i - 1].dsCoord <= - ADD_INT32( hintmap->edge[i].dsCoord, - moveDown - downMinCounter ) ) + ADD_INT32( dsCoord_i, moveDown - downMinCounter ) ) { move = moveDown; /* true if non-optimum move */ @@ -524,17 +527,21 @@ } /* move the edge(s) */ - hintmap->edge[i].dsCoord = ADD_INT32( hintmap->edge[i].dsCoord, - move ); + hintmap->edge[i].dsCoord = ADD_INT32( dsCoord_i, move ); if ( isPair ) - hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord, - move ); + hintmap->edge[j].dsCoord = ADD_INT32( dsCoord_j, move ); } - /* assert there are no overlaps in device space */ + /* assert there are no overlaps in device space; */ + /* ignore tests if there was overflow (that is, if */ + /* operands have the same sign but the sum does not) */ FT_ASSERT( i == 0 || + ( ( dsCoord_i ^ move ) >= 0 && + ( dsCoord_i ^ hintmap->edge[i].dsCoord ) < 0 ) || hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord ); FT_ASSERT( i < j || + ( ( dsCoord_j ^ move ) >= 0 && + ( dsCoord_j ^ hintmap->edge[j].dsCoord ) < 0 ) || hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord ); /* adjust the scales, avoiding divide by zero */ @@ -1022,10 +1029,17 @@ } } - FT_TRACE6(( "%s\n", initialMap ? "flags: [p]air [g]host [t]op" - " [b]ottom [L]ocked [S]ynthetic\n" - "Initial hintmap" - : "Hints:" )); +#ifdef FT_DEBUG_LEVEL_TRACE + if ( initialMap ) + { + FT_TRACE6(( "flags: [p]air [g]host [t]op" + " [b]ottom [L]ocked [S]ynthetic\n" )); + FT_TRACE6(( "Initial hintmap" )); + } + else + FT_TRACE6(( "Hints:" )); +#endif + cf2_hintmap_dump( hintmap ); /* diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c index 519c6944475..40e92766389 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c @@ -1340,9 +1340,9 @@ if ( decoder->glyph_names == 0 ) #endif /* FT_CONFIG_OPTION_INCREMENTAL */ { - FT_ERROR(( - "cf2_interpT2CharString: (Type 1 seac)" - " glyph names table not available in this font\n" )); + FT_ERROR(( "cf2_interpT2CharString:\n" )); + FT_ERROR(( " (Type 1 seac) glyph names table" + " not available in this font\n" )); lastError = FT_THROW( Invalid_Glyph_Format ); goto exit; } @@ -1368,9 +1368,9 @@ if ( bchar_index < 0 || achar_index < 0 ) { - FT_ERROR(( - "cf2_interpT2CharString: (Type 1 seac)" - " invalid seac character code arguments\n" )); + FT_ERROR(( "cf2_interpT2CharString:\n" )); + FT_ERROR(( " (Type 1 seac) invalid" + " seac character code arguments\n" )); lastError = FT_THROW( Invalid_Glyph_Format ); goto exit; } @@ -1670,7 +1670,13 @@ */ count = cf2_stack_count( opStack ); - FT_ASSERT( (CF2_UInt)arg_cnt <= count ); + if ( (CF2_UInt)arg_cnt > count ) + { + FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):" + " stack underflow\n" )); + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } opIdx += count - (CF2_UInt)arg_cnt; diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c index defc4d4fcee..30f501916a6 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (body). * - * Copyright (C) 1996-2020 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -251,7 +251,7 @@ if ( !old_base ) return; - if ( FT_ALLOC( table->block, table->cursor ) ) + if ( FT_QALLOC( table->block, table->cursor ) ) return; FT_MEM_COPY( table->block, old_base, table->cursor ); shift_elements( table, old_base ); @@ -595,10 +595,10 @@ if ( cur < limit && cur == parser->cursor ) { FT_ERROR(( "ps_parser_skip_PS_token:" - " current token is `%c' which is self-delimiting\n" - " " - " but invalid at this point\n", + " current token is `%c' which is self-delimiting\n", *cur )); + FT_ERROR(( " " + " but invalid at this point\n" )); error = FT_THROW( Invalid_File_Format ); } @@ -979,7 +979,7 @@ } len = (FT_UInt)( cur - *cursor ); - if ( cur >= limit || FT_ALLOC( result, len + 1 ) ) + if ( cur >= limit || FT_QALLOC( result, len + 1 ) ) return 0; /* now copy the string */ @@ -1175,8 +1175,8 @@ else { FT_ERROR(( "ps_parser_load_field:" - " expected a name or string\n" - " " + " expected a name or string\n" )); + FT_ERROR(( " " " but found token of type %d instead\n", token.type )); error = FT_THROW( Invalid_File_Format ); @@ -1193,7 +1193,7 @@ *(FT_String**)q = NULL; } - if ( FT_ALLOC( string, len + 1 ) ) + if ( FT_QALLOC( string, len + 1 ) ) goto Exit; FT_MEM_COPY( string, cur, len ); @@ -1248,7 +1248,7 @@ FT_UInt i; - if ( FT_NEW_ARRAY( temp, max_objects * 4 ) ) + if ( FT_QNEW_ARRAY( temp, max_objects * 4 ) ) goto Exit; for ( i = 0; i < 4; i++ ) @@ -1258,14 +1258,14 @@ if ( result < 0 || (FT_UInt)result < max_objects ) { FT_ERROR(( "ps_parser_load_field:" - " expected %d integer%s in the %s subarray\n" - " " - " of /FontBBox in the /Blend dictionary\n", + " expected %d integer%s in the %s subarray\n", max_objects, max_objects > 1 ? "s" : "", i == 0 ? "first" : ( i == 1 ? "second" : ( i == 2 ? "third" : "fourth" ) ) )); + FT_ERROR(( " " + " of /FontBBox in the /Blend dictionary\n" )); error = FT_THROW( Invalid_File_Format ); FT_FREE( temp ); diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h index fdad672b6d2..99d16959a73 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (specification). * - * Copyright (C) 1996-2020 by + * Copyright (C) 1996-2021 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/psaux/psstack.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c index 7ae5256ef19..bc8888c3ab3 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c @@ -59,15 +59,14 @@ CF2_Stack stack = NULL; - if ( FT_NEW( stack ) ) + if ( FT_QNEW( stack ) ) return NULL; - /* initialize the structure; FT_NEW zeroes it */ stack->memory = memory; stack->error = e; /* allocate the stack buffer */ - if ( FT_NEW_ARRAY( stack->buffer, stackSize ) ) + if ( FT_QNEW_ARRAY( stack->buffer, stackSize ) ) { FT_FREE( stack ); return NULL; diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk b/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk index f49aecbc794..05439120dd2 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2020 by +# Copyright (C) 1996-2021 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/psaux/t1cmap.c b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c index e21e93ca268..3e7c577a18c 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ * * Type 1 character map support (body). * - * Copyright (C) 2002-2020 by + * Copyright (C) 2002-2021 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/psaux/t1cmap.h b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h index 031796510f7..8f69600ca40 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ * * Type 1 character map support (specification). * - * Copyright (C) 2002-2020 by + * Copyright (C) 2002-2021 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/psaux/t1decode.c b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c index 2ed27ca19ef..ee1cb263449 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (body). * - * Copyright (C) 2000-2020 by + * Copyright (C) 2000-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -517,7 +517,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE if ( bol ) { - FT_TRACE5(( " (%d)", decoder->top - decoder->stack )); + FT_TRACE5(( " (%ld)", decoder->top - decoder->stack )); bol = FALSE; } #endif @@ -1162,9 +1162,9 @@ if ( top - decoder->stack != num_args ) FT_TRACE0(( "t1_decoder_parse_charstrings:" " too much operands on the stack" - " (seen %d, expected %d)\n", + " (seen %ld, expected %d)\n", top - decoder->stack, num_args )); - break; + break; } #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -1209,7 +1209,7 @@ FT_TRACE4(( "BuildCharArray = [ " )); for ( i = 0; i < decoder->len_buildchar; i++ ) - FT_TRACE4(( "%d ", decoder->buildchar[i] )); + FT_TRACE4(( "%ld ", decoder->buildchar[i] )); FT_TRACE4(( "]\n" )); } @@ -1650,7 +1650,8 @@ } /* while ip < limit */ - FT_TRACE4(( "..end..\n\n" )); + FT_TRACE4(( "..end..\n" )); + FT_TRACE4(( "\n" )); Fail: return error; @@ -2070,7 +2071,8 @@ } /* while ip < limit */ - FT_TRACE4(( "..end..\n\n" )); + FT_TRACE4(( "..end..\n" )); + FT_TRACE4(( "\n" )); No_Width: FT_ERROR(( "t1_decoder_parse_metrics:" diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h index b793504ac6a..eea9d34b042 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (specification). * - * Copyright (C) 2000-2020 by + * Copyright (C) 2000-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, |