Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType
Commits:
-
baa0f71d
by Alexei Podtelezhnikov at 2021-04-23T13:48:34-04:00
-
ec9e5114
by Alexei Podtelezhnikov at 2021-04-23T14:03:03-04:00
8 changed files:
- ChangeLog
- src/cff/cffdrivr.c
- src/cff/cffload.c
- src/cid/cidgload.c
- src/cid/cidload.c
- src/type1/t1load.c
- src/type1/t1parse.c
- src/type42/t42parse.c
Changes:
1 |
+2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
|
|
2 |
+ |
|
3 |
+ [cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
|
|
4 |
+ |
|
5 |
+ * src/cff/cffload.c (cff_index_get_pointers, cff_index_get_name):
|
|
6 |
+ Do not zero out the buffer.
|
|
7 |
+ * src/cff/cffdrivr.c (cff_ps_get_font_info): Ditto.
|
|
8 |
+ * src/type1/t1load.c (parse_subrs, parse_charstrings,
|
|
9 |
+ parse_blend_axis_types): Ditto.
|
|
10 |
+ * src/type1/t1parse.c (T1_New_Parser, T1_Get_Private_Dict): Ditto.
|
|
11 |
+ * src/type42/t42parse.c (t42_parser_init): Ditto.
|
|
12 |
+ |
|
13 |
+2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
|
|
14 |
+ |
|
15 |
+ [cid] s/FT_ALLOC/FT_QALLOC/ and clean up.
|
|
16 |
+ |
|
17 |
+ * src/cid/cidgload.c (cid_load_glyph): Do not zero out the buffer.
|
|
18 |
+ * src/cid/cidload.c (cid_face_open, cid_read_subrs): Ditto.
|
|
19 |
+ |
|
1 | 20 |
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
|
2 | 21 |
|
3 | 22 |
[pfr] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
|
... | ... | @@ -478,7 +478,7 @@ |
478 | 478 |
FT_Memory memory = face->root.memory;
|
479 | 479 |
|
480 | 480 |
|
481 |
- if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
|
|
481 |
+ if ( FT_QALLOC( font_info, sizeof ( *font_info ) ) )
|
|
482 | 482 |
goto Fail;
|
483 | 483 |
|
484 | 484 |
font_info->version = cff_index_get_sid_string( cff,
|
... | ... | @@ -426,9 +426,9 @@ |
426 | 426 |
|
427 | 427 |
new_size = idx->data_size + idx->count;
|
428 | 428 |
|
429 |
- if ( idx->count > 0 &&
|
|
430 |
- !FT_NEW_ARRAY( tbl, idx->count + 1 ) &&
|
|
431 |
- ( !pool || !FT_ALLOC( new_bytes, new_size ) ) )
|
|
429 |
+ if ( idx->count > 0 &&
|
|
430 |
+ !FT_NEW_ARRAY( tbl, idx->count + 1 ) &&
|
|
431 |
+ ( !pool || !FT_QALLOC( new_bytes, new_size ) ) )
|
|
432 | 432 |
{
|
433 | 433 |
FT_ULong n, cur_offset;
|
434 | 434 |
FT_ULong extra = 0;
|
... | ... | @@ -634,10 +634,9 @@ |
634 | 634 |
if ( error )
|
635 | 635 |
goto Exit;
|
636 | 636 |
|
637 |
- if ( !FT_ALLOC( name, byte_len + 1 ) )
|
|
637 |
+ if ( !FT_QALLOC( name, byte_len + 1 ) )
|
|
638 | 638 |
{
|
639 |
- if ( byte_len )
|
|
640 |
- FT_MEM_COPY( name, bytes, byte_len );
|
|
639 |
+ FT_MEM_COPY( name, bytes, byte_len );
|
|
641 | 640 |
name[byte_len] = 0;
|
642 | 641 |
}
|
643 | 642 |
cff_index_forget_element( idx, &bytes );
|
... | ... | @@ -85,10 +85,10 @@ |
85 | 85 |
if ( glyph_data.length != 0 )
|
86 | 86 |
{
|
87 | 87 |
glyph_length = (FT_ULong)( glyph_data.length - cid->fd_bytes );
|
88 |
- (void)FT_ALLOC( charstring, glyph_length );
|
|
89 |
- if ( !error )
|
|
90 |
- ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
|
|
91 |
- glyph_length );
|
|
88 |
+ |
|
89 |
+ if ( !FT_QALLOC( charstring, glyph_length ) )
|
|
90 |
+ FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes,
|
|
91 |
+ glyph_length );
|
|
92 | 92 |
}
|
93 | 93 |
|
94 | 94 |
inc->funcs->free_glyph_data( inc->object, &glyph_data );
|
... | ... | @@ -130,11 +130,9 @@ |
130 | 130 |
}
|
131 | 131 |
|
132 | 132 |
glyph_length = off2 - off1;
|
133 |
- if ( glyph_length == 0 )
|
|
134 |
- goto Exit;
|
|
135 |
- if ( FT_ALLOC( charstring, glyph_length ) )
|
|
136 |
- goto Exit;
|
|
137 |
- if ( FT_STREAM_READ_AT( cid->data_offset + off1,
|
|
133 |
+ |
|
134 |
+ if ( FT_QALLOC( charstring, glyph_length ) ||
|
|
135 |
+ FT_STREAM_READ_AT( cid->data_offset + off1,
|
|
138 | 136 |
charstring, glyph_length ) )
|
139 | 137 |
goto Exit;
|
140 | 138 |
}
|
... | ... | @@ -590,7 +590,7 @@ |
590 | 590 |
data_len = offsets[num_subrs] - offsets[0];
|
591 | 591 |
|
592 | 592 |
if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||
|
593 |
- FT_ALLOC( subr->code[0], data_len ) )
|
|
593 |
+ FT_QALLOC( subr->code[0], data_len ) )
|
|
594 | 594 |
goto Fail;
|
595 | 595 |
|
596 | 596 |
if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
|
... | ... | @@ -812,7 +812,7 @@ |
812 | 812 |
}
|
813 | 813 |
|
814 | 814 |
/* we must convert the data section from hexadecimal to binary */
|
815 |
- if ( FT_ALLOC( face->binary_data, parser->binary_length ) ||
|
|
815 |
+ if ( FT_QALLOC( face->binary_data, parser->binary_length ) ||
|
|
816 | 816 |
FT_SET_ERROR( cid_hex_to_binary( face->binary_data,
|
817 | 817 |
parser->binary_length,
|
818 | 818 |
parser->data_offset,
|
... | ... | @@ -851,7 +851,7 @@ |
851 | 851 |
FT_FREE( name );
|
852 | 852 |
}
|
853 | 853 |
|
854 |
- if ( FT_ALLOC( blend->axis_names[n], len + 1 ) )
|
|
854 |
+ if ( FT_QALLOC( blend->axis_names[n], len + 1 ) )
|
|
855 | 855 |
goto Exit;
|
856 | 856 |
|
857 | 857 |
name = (FT_Byte*)blend->axis_names[n];
|
... | ... | @@ -1858,7 +1858,7 @@ |
1858 | 1858 |
}
|
1859 | 1859 |
|
1860 | 1860 |
/* t1_decrypt() shouldn't write to base -- make temporary copy */
|
1861 |
- if ( FT_ALLOC( temp, size ) )
|
|
1861 |
+ if ( FT_QALLOC( temp, size ) )
|
|
1862 | 1862 |
goto Fail;
|
1863 | 1863 |
FT_MEM_COPY( temp, base, size );
|
1864 | 1864 |
psaux->t1_decrypt( temp, size, 4330 );
|
... | ... | @@ -2068,7 +2068,7 @@ |
2068 | 2068 |
}
|
2069 | 2069 |
|
2070 | 2070 |
/* t1_decrypt() shouldn't write to base -- make temporary copy */
|
2071 |
- if ( FT_ALLOC( temp, size ) )
|
|
2071 |
+ if ( FT_QALLOC( temp, size ) )
|
|
2072 | 2072 |
goto Fail;
|
2073 | 2073 |
FT_MEM_COPY( temp, base, size );
|
2074 | 2074 |
psaux->t1_decrypt( temp, size, 4330 );
|
... | ... | @@ -221,7 +221,7 @@ |
221 | 221 |
else
|
222 | 222 |
{
|
223 | 223 |
/* read segment in memory -- this is clumsy, but so does the format */
|
224 |
- if ( FT_ALLOC( parser->base_dict, size ) ||
|
|
224 |
+ if ( FT_QALLOC( parser->base_dict, size ) ||
|
|
225 | 225 |
FT_STREAM_READ( parser->base_dict, size ) )
|
226 | 226 |
goto Exit;
|
227 | 227 |
parser->base_len = size;
|
... | ... | @@ -302,8 +302,8 @@ |
302 | 302 |
goto Fail;
|
303 | 303 |
}
|
304 | 304 |
|
305 |
- if ( FT_STREAM_SEEK( start_pos ) ||
|
|
306 |
- FT_ALLOC( parser->private_dict, parser->private_len ) )
|
|
305 |
+ if ( FT_STREAM_SEEK( start_pos ) ||
|
|
306 |
+ FT_QALLOC( parser->private_dict, parser->private_len ) )
|
|
307 | 307 |
goto Fail;
|
308 | 308 |
|
309 | 309 |
parser->private_len = 0;
|
... | ... | @@ -450,7 +450,7 @@ |
450 | 450 |
if ( parser->in_memory )
|
451 | 451 |
{
|
452 | 452 |
/* note that we allocate one more byte to put a terminating `0' */
|
453 |
- if ( FT_ALLOC( parser->private_dict, size + 1 ) )
|
|
453 |
+ if ( FT_QALLOC( parser->private_dict, size + 1 ) )
|
|
454 | 454 |
goto Fail;
|
455 | 455 |
parser->private_len = size;
|
456 | 456 |
}
|
... | ... | @@ -197,7 +197,7 @@ |
197 | 197 |
else
|
198 | 198 |
{
|
199 | 199 |
/* read segment in memory */
|
200 |
- if ( FT_ALLOC( parser->base_dict, size ) ||
|
|
200 |
+ if ( FT_QALLOC( parser->base_dict, size ) ||
|
|
201 | 201 |
FT_STREAM_READ( parser->base_dict, size ) )
|
202 | 202 |
goto Exit;
|
203 | 203 |
|