[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> 2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers. [cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.

View File

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

View File

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

View File

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

View File

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