diff options
author | Jungshik Shin <jungshik@google.com> | 2016-09-18 03:50:36 -0700 |
---|---|---|
committer | Sean McCreary <mccreary@mcwest.org> | 2017-04-07 16:53:42 -0600 |
commit | 3ff870b9dbbd88173df82269d3c1cffb1eba2eda (patch) | |
tree | 0e443679e800bb442b2cbb2f7ae086b787ca65ff /src/cff/cffload.c | |
parent | f720f0dbcf012d6c984dbbefa0875ef9840458c6 (diff) | |
download | android_external_freetype-3ff870b9dbbd88173df82269d3c1cffb1eba2eda.tar.gz android_external_freetype-3ff870b9dbbd88173df82269d3c1cffb1eba2eda.tar.bz2 android_external_freetype-3ff870b9dbbd88173df82269d3c1cffb1eba2eda.zip |
Update FreeType from 2.6.2 to c38be52bf8de (2.7 + a few post-2.7 CLs)HEADreplicant-6.0-0002replicant-6.0-0001cm-13.0
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=c38be52b
Keep all the configuration options as before.
Likewise, exclude unused files (Jamfiles, various mk files, builds/,
docs/, ChangeLog*, directories under src/ for disabled modules, etc).
Update README.android to record the configurations.
Besides, disable a new option (TT_CONFIG_OPTION_SUBPIXEL_HINTING) for
branches. Note that a bulk of changes in this CL come from the code to
implement this option.
BUG: 31470908
AOSP-Change-Id: I1ca90aec171d9580415b8531e2b767e9dd31164c
CVE-2016-10244
Change-Id: I4485d2ea543c52f8145ab23372cf3e5c7345879b
(cherry picked from commit 055aee28cedc3631434b2636fc6093c0d4d818ab)
Diffstat (limited to 'src/cff/cffload.c')
-rw-r--r-- | src/cff/cffload.c | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/src/cff/cffload.c b/src/cff/cffload.c index c61222d..470fa82 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -4,7 +4,7 @@ /* */ /* OpenType and CFF data/program tables loader (body). */ /* */ -/* Copyright 1996-2015 by */ +/* Copyright 1996-2016 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -382,13 +382,15 @@ static FT_Error cff_index_get_pointers( CFF_Index idx, FT_Byte*** table, - FT_Byte** pool ) + FT_Byte** pool, + FT_ULong* pool_size ) { FT_Error error = FT_Err_Ok; FT_Memory memory = idx->stream->memory; FT_Byte** t = NULL; FT_Byte* new_bytes = NULL; + FT_ULong new_size; *table = NULL; @@ -400,10 +402,11 @@ goto Exit; } - if ( idx->count > 0 && - !FT_NEW_ARRAY( t, idx->count + 1 ) && - ( !pool || !FT_ALLOC( new_bytes, - idx->data_size + idx->count ) ) ) + new_size = idx->data_size + idx->count; + + if ( idx->count > 0 && + !FT_NEW_ARRAY( t, idx->count + 1 ) && + ( !pool || !FT_ALLOC( new_bytes, new_size ) ) ) { FT_ULong n, cur_offset; FT_ULong extra = 0; @@ -459,6 +462,8 @@ if ( pool ) *pool = new_bytes; + if ( pool_size ) + *pool_size = new_size; } Exit: @@ -501,8 +506,8 @@ { element++; off2 = cff_index_read_offset( idx, &error ); - } - while ( off2 == 0 && element < idx->count ); + + } while ( off2 == 0 && element < idx->count ); } } else /* use offsets table */ @@ -597,7 +602,8 @@ if ( !FT_ALLOC( name, byte_len + 1 ) ) { - FT_MEM_COPY( name, bytes, byte_len ); + if ( byte_len ) + FT_MEM_COPY( name, bytes, byte_len ); name[byte_len] = 0; } cff_index_forget_element( idx, &bytes ); @@ -809,7 +815,7 @@ /* When multiple GIDs map to the same CID, we choose the lowest */ /* GID. This is not described in any spec, but it matches the */ /* behaviour of recent Acroread versions. */ - for ( j = (FT_Long)num_glyphs - 1; j >= 0 ; j-- ) + for ( j = (FT_Long)num_glyphs - 1; j >= 0; j-- ) charset->cids[charset->sids[j]] = (FT_UShort)j; charset->max_cid = max_cid; @@ -871,8 +877,8 @@ FT_UShort glyph_sid; - /* If the the offset is greater than 2, we have to parse the */ - /* charset table. */ + /* If the offset is greater than 2, we have to parse the charset */ + /* table. */ if ( offset > 2 ) { FT_UInt j; @@ -1316,7 +1322,12 @@ CFF_Private priv = &font->private_dict; - cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict, library ); + cff_parser_init( &parser, + CFF_CODE_TOPDICT, + &font->font_dict, + library, + 0, + 0 ); /* set defaults */ FT_MEM_ZERO( top, sizeof ( *top ) ); @@ -1370,7 +1381,12 @@ priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L ); priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 ); - cff_parser_init( &parser, CFF_CODE_PRIVATE, priv, library ); + cff_parser_init( &parser, + CFF_CODE_PRIVATE, + priv, + library, + top->num_designs, + top->num_axes ); if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) || FT_FRAME_ENTER( font->font_dict.private_size ) ) @@ -1400,7 +1416,7 @@ goto Exit; error = cff_index_get_pointers( &font->local_subrs_index, - &font->local_subrs, NULL ); + &font->local_subrs, NULL, NULL ); if ( error ) goto Exit; } @@ -1478,16 +1494,17 @@ /* read the name, top dict, string and global subrs index */ if ( FT_SET_ERROR( cff_index_init( &font->name_index, - stream, 0 ) ) || + stream, 0 ) ) || FT_SET_ERROR( cff_index_init( &font->font_dict_index, - stream, 0 ) ) || + stream, 0 ) ) || FT_SET_ERROR( cff_index_init( &string_index, - stream, 1 ) ) || + stream, 1 ) ) || FT_SET_ERROR( cff_index_init( &font->global_subrs_index, - stream, 1 ) ) || + stream, 1 ) ) || FT_SET_ERROR( cff_index_get_pointers( &string_index, &font->strings, - &font->string_pool ) ) ) + &font->string_pool, + &font->string_pool_size ) ) ) goto Exit; font->num_strings = string_index.count; @@ -1614,7 +1631,7 @@ font->num_glyphs = font->charstrings_index.count; error = cff_index_get_pointers( &font->global_subrs_index, - &font->global_subrs, NULL ); + &font->global_subrs, NULL, NULL ); if ( error ) goto Exit; |