ref: ec9e5114b1fc878d8e26611ceacd7b2a2400a73c
parent: baa0f71ddff8497a0e14fce9e3c74db034f3036d
author: Alexei Podtelezhnikov <[email protected]>
date: Fri Apr 23 10:03:03 EDT 2021
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2021-04-23 Alexei Podtelezhnikov <[email protected]>
+ [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 <[email protected]>
+
[cid] s/FT_ALLOC/FT_QALLOC/ and clean up.
* src/cid/cidgload.c (cid_load_glyph): Do not zero out the buffer.
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -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,
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -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 );
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -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 );
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -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;
}
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -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;