[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
diff --git a/ChangeLog b/ChangeLog
index 60d5d84..81a43a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
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.
* src/cid/cidgload.c (cid_load_glyph): Do not zero out the buffer.
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 33d161a..9bde3c7 100644
--- 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,
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index d3c3323..210ada1 100644
--- 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 );
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index b9925ae..fe6239f 100644
--- 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 );
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index 5c529d3..9f22629 100644
--- 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;
}
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index e8e003a..9cd9e6c 100644
--- 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;