... |
... |
@@ -167,8 +167,7 @@ |
167
|
167
|
FT_UShort num_names;
|
168
|
168
|
|
169
|
169
|
FT_UShort* glyph_indices = NULL;
|
170
|
|
- FT_Char** name_strings = NULL;
|
171
|
|
- FT_Byte* strings = NULL;
|
|
170
|
+ FT_Byte** name_strings = NULL;
|
172
|
171
|
|
173
|
172
|
|
174
|
173
|
if ( FT_READ_USHORT( num_glyphs ) )
|
... |
... |
@@ -229,13 +228,17 @@ |
229
|
228
|
{
|
230
|
229
|
FT_UShort n;
|
231
|
230
|
FT_ULong p;
|
|
231
|
+ FT_Byte* strings;
|
232
|
232
|
|
233
|
233
|
|
234
|
234
|
post_len -= (FT_ULong)num_glyphs * 2UL + 2;
|
235
|
235
|
|
236
|
|
- if ( FT_QALLOC( strings, post_len + 1 ) ||
|
237
|
|
- FT_STREAM_READ( strings, post_len ) ||
|
238
|
|
- FT_QNEW_ARRAY( name_strings, num_names ) )
|
|
236
|
+ if ( FT_QALLOC( name_strings, num_names * sizeof ( FT_Byte* ) +
|
|
237
|
+ post_len + 1 ) )
|
|
238
|
+ goto Fail;
|
|
239
|
+
|
|
240
|
+ strings = (FT_Byte*)( name_strings + num_names );
|
|
241
|
+ if ( FT_STREAM_READ( strings, post_len ) )
|
239
|
242
|
goto Fail;
|
240
|
243
|
|
241
|
244
|
/* convert from Pascal- to C-strings and set pointers */
|
... |
... |
@@ -251,7 +254,7 @@ |
251
|
254
|
}
|
252
|
255
|
|
253
|
256
|
strings[p] = 0;
|
254
|
|
- name_strings[n] = (FT_Char*)strings + p + 1;
|
|
257
|
+ name_strings[n] = strings + p + 1;
|
255
|
258
|
p += len + 1;
|
256
|
259
|
}
|
257
|
260
|
strings[post_len] = 0;
|
... |
... |
@@ -259,22 +262,11 @@ |
259
|
262
|
/* deal with missing or insufficient string data */
|
260
|
263
|
if ( n < num_names )
|
261
|
264
|
{
|
262
|
|
- if ( post_len == 0 )
|
263
|
|
- {
|
264
|
|
- /* fake empty string */
|
265
|
|
- if ( FT_QREALLOC( strings, 1, 2 ) )
|
266
|
|
- goto Fail;
|
|
265
|
+ FT_TRACE4(( "load_format_20: %hu PostScript names are truncated\n",
|
|
266
|
+ num_names - n ));
|
267
|
267
|
|
268
|
|
- post_len = 1;
|
269
|
|
- strings[post_len] = 0;
|
270
|
|
- }
|
271
|
|
-
|
272
|
|
- FT_ERROR(( "load_format_20:"
|
273
|
|
- " all entries in post table are already parsed,"
|
274
|
|
- " using NULL names for gid %d - %d\n",
|
275
|
|
- n, num_names - 1 ));
|
276
|
268
|
for ( ; n < num_names; n++ )
|
277
|
|
- name_strings[n] = (FT_Char*)strings + post_len;
|
|
269
|
+ name_strings[n] = strings + post_len;
|
278
|
270
|
}
|
279
|
271
|
}
|
280
|
272
|
|
... |
... |
@@ -292,7 +284,6 @@ |
292
|
284
|
|
293
|
285
|
Fail:
|
294
|
286
|
FT_FREE( name_strings );
|
295
|
|
- FT_FREE( strings );
|
296
|
287
|
FT_FREE( glyph_indices );
|
297
|
288
|
|
298
|
289
|
Exit:
|
... |
... |
@@ -427,9 +418,6 @@ |
427
|
418
|
|
428
|
419
|
if ( table->num_names )
|
429
|
420
|
{
|
430
|
|
- table->glyph_names[0]--;
|
431
|
|
- FT_FREE( table->glyph_names[0] );
|
432
|
|
-
|
433
|
421
|
FT_FREE( table->glyph_names );
|
434
|
422
|
table->num_names = 0;
|
435
|
423
|
}
|