[sfnt] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.

* src/sfnt/sfdriver.c (get_win_string, get_apple_string,
sfnt_get_var_ps_name): Do not zero out the buffer.
* src/sfnt/sfobjs.c (sfnt_init_face): Ditto.
* src/sfnt/sfwoff.c (woff_open_font): Ditto.
* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
This commit is contained in:
Alexei Podtelezhnikov 2021-04-23 19:22:51 -04:00
parent ec9e5114b1
commit 6ada59ab7c
5 changed files with 26 additions and 15 deletions

View File

@ -1,3 +1,13 @@
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string,
sfnt_get_var_ps_name): Do not zero out the buffer.
* src/sfnt/sfobjs.c (sfnt_init_face): Ditto.
* src/sfnt/sfwoff.c (woff_open_font): Ditto.
* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.

View File

@ -501,7 +501,7 @@
FT_UNUSED( error );
if ( FT_ALLOC( result, entry->stringLength / 2 + 1 ) )
if ( FT_QALLOC( result, entry->stringLength / 2 + 1 ) )
return NULL;
if ( FT_STREAM_SEEK( entry->stringOffset ) ||
@ -560,7 +560,7 @@
FT_UNUSED( error );
if ( FT_ALLOC( result, entry->stringLength + 1 ) )
if ( FT_QALLOC( result, entry->stringLength + 1 ) )
return NULL;
if ( FT_STREAM_SEEK( entry->stringOffset ) ||
@ -928,8 +928,8 @@
/* after the prefix we have character `-' followed by the */
/* subfamily name (using only characters a-z, A-Z, and 0-9) */
if ( FT_ALLOC( result, face->var_postscript_prefix_len +
1 + ft_strlen( subfamily_name ) + 1 ) )
if ( FT_QALLOC( result, face->var_postscript_prefix_len +
1 + ft_strlen( subfamily_name ) + 1 ) )
return NULL;
ft_strcpy( result, face->var_postscript_prefix );
@ -957,9 +957,9 @@
construct_instance_name:
axis = mm_var->axis;
if ( FT_ALLOC( result,
face->var_postscript_prefix_len +
num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) )
if ( FT_QALLOC( result,
face->var_postscript_prefix_len +
num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) )
return NULL;
p = result;
@ -993,6 +993,7 @@
if ( t != ' ' && ft_isalnum( t ) )
*p++ = t;
}
*p++ = '\0';
}
check_length:

View File

@ -643,8 +643,8 @@
*/
if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
!( FT_ALLOC( default_values, num_axes * 4 ) ||
FT_ALLOC( instance_values, num_axes * 4 ) ) )
!( FT_QALLOC( default_values, num_axes * 4 ) ||
FT_QALLOC( instance_values, num_axes * 4 ) ) )
{
/* the current stream position is 16 bytes after the table start */
FT_ULong array_start = FT_STREAM_POS() - 16 + offset;

View File

@ -160,8 +160,8 @@
}
/* Don't trust `totalSfntSize' before thorough checks. */
if ( FT_ALLOC( sfnt, 12 + woff.num_tables * 16UL ) ||
FT_NEW( sfnt_stream ) )
if ( FT_QALLOC( sfnt, 12 + woff.num_tables * 16UL ) ||
FT_NEW( sfnt_stream ) )
goto Exit;
sfnt_header = sfnt;

View File

@ -2174,8 +2174,8 @@
}
/* Write sfnt header. */
if ( FT_ALLOC( sfnt, sfnt_size ) ||
FT_NEW( sfnt_stream ) )
if ( FT_QALLOC( sfnt, sfnt_size ) ||
FT_NEW( sfnt_stream ) )
goto Exit;
sfnt_header = sfnt;
@ -2246,8 +2246,8 @@
}
/* Allocate memory for uncompressed table data. */
if ( FT_ALLOC( uncompressed_buf, woff2.uncompressed_size ) ||
FT_FRAME_ENTER( woff2.totalCompressedSize ) )
if ( FT_QALLOC( uncompressed_buf, woff2.uncompressed_size ) ||
FT_FRAME_ENTER( woff2.totalCompressedSize ) )
goto Exit;
/* Uncompress the stream. */