[cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.

* src/cff/cffload.c (cff_index_get_pointers, cff_index_get_name):
Do not zero out the buffer.
* src/cff/cffdrivr.c (cff_ps_get_font_info): Ditto.
* src/type1/t1load.c (parse_subrs, parse_charstrings,
parse_blend_axis_types): Ditto.
* src/type1/t1parse.c (T1_New_Parser, T1_Get_Private_Dict): Ditto.
* src/type42/t42parse.c (t42_parser_init): Ditto.
This commit is contained in:
Alexei Podtelezhnikov 2021-04-23 14:03:03 -04:00
parent baa0f71ddf
commit ec9e5114b1
6 changed files with 26 additions and 15 deletions

View File

@ -1,3 +1,15 @@
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/cff/cffload.c (cff_index_get_pointers, cff_index_get_name):
Do not zero out the buffer.
* src/cff/cffdrivr.c (cff_ps_get_font_info): Ditto.
* src/type1/t1load.c (parse_subrs, parse_charstrings,
parse_blend_axis_types): Ditto.
* src/type1/t1parse.c (T1_New_Parser, T1_Get_Private_Dict): Ditto.
* src/type42/t42parse.c (t42_parser_init): Ditto.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[cid] s/FT_ALLOC/FT_QALLOC/ and clean up.

View File

@ -478,7 +478,7 @@
FT_Memory memory = face->root.memory;
if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
if ( FT_QALLOC( font_info, sizeof ( *font_info ) ) )
goto Fail;
font_info->version = cff_index_get_sid_string( cff,

View File

@ -426,9 +426,9 @@
new_size = idx->data_size + idx->count;
if ( idx->count > 0 &&
!FT_NEW_ARRAY( tbl, idx->count + 1 ) &&
( !pool || !FT_ALLOC( new_bytes, new_size ) ) )
if ( idx->count > 0 &&
!FT_NEW_ARRAY( tbl, idx->count + 1 ) &&
( !pool || !FT_QALLOC( new_bytes, new_size ) ) )
{
FT_ULong n, cur_offset;
FT_ULong extra = 0;
@ -634,10 +634,9 @@
if ( error )
goto Exit;
if ( !FT_ALLOC( name, byte_len + 1 ) )
if ( !FT_QALLOC( name, byte_len + 1 ) )
{
if ( byte_len )
FT_MEM_COPY( name, bytes, byte_len );
FT_MEM_COPY( name, bytes, byte_len );
name[byte_len] = 0;
}
cff_index_forget_element( idx, &bytes );

View File

@ -851,7 +851,7 @@
FT_FREE( name );
}
if ( FT_ALLOC( blend->axis_names[n], len + 1 ) )
if ( FT_QALLOC( blend->axis_names[n], len + 1 ) )
goto Exit;
name = (FT_Byte*)blend->axis_names[n];
@ -1858,7 +1858,7 @@
}
/* t1_decrypt() shouldn't write to base -- make temporary copy */
if ( FT_ALLOC( temp, size ) )
if ( FT_QALLOC( temp, size ) )
goto Fail;
FT_MEM_COPY( temp, base, size );
psaux->t1_decrypt( temp, size, 4330 );
@ -2068,7 +2068,7 @@
}
/* t1_decrypt() shouldn't write to base -- make temporary copy */
if ( FT_ALLOC( temp, size ) )
if ( FT_QALLOC( temp, size ) )
goto Fail;
FT_MEM_COPY( temp, base, size );
psaux->t1_decrypt( temp, size, 4330 );

View File

@ -221,7 +221,7 @@
else
{
/* read segment in memory -- this is clumsy, but so does the format */
if ( FT_ALLOC( parser->base_dict, size ) ||
if ( FT_QALLOC( parser->base_dict, size ) ||
FT_STREAM_READ( parser->base_dict, size ) )
goto Exit;
parser->base_len = size;
@ -302,8 +302,8 @@
goto Fail;
}
if ( FT_STREAM_SEEK( start_pos ) ||
FT_ALLOC( parser->private_dict, parser->private_len ) )
if ( FT_STREAM_SEEK( start_pos ) ||
FT_QALLOC( parser->private_dict, parser->private_len ) )
goto Fail;
parser->private_len = 0;
@ -450,7 +450,7 @@
if ( parser->in_memory )
{
/* note that we allocate one more byte to put a terminating `0' */
if ( FT_ALLOC( parser->private_dict, size + 1 ) )
if ( FT_QALLOC( parser->private_dict, size + 1 ) )
goto Fail;
parser->private_len = size;
}

View File

@ -197,7 +197,7 @@
else
{
/* read segment in memory */
if ( FT_ALLOC( parser->base_dict, size ) ||
if ( FT_QALLOC( parser->base_dict, size ) ||
FT_STREAM_READ( parser->base_dict, size ) )
goto Exit;