[glyf] Limit points in a glyf to 10000 roughly

Only enforced when components are being expanded.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3838
This commit is contained in:
Behdad Esfahbod 2022-10-26 13:11:47 -06:00
parent 9aad3dba8f
commit 477d71724c
1 changed files with 8 additions and 0 deletions

View File

@ -16,6 +16,11 @@ struct glyf_accelerator_t;
namespace glyf_impl {
#ifndef HB_GLYF_MAX_POINTS
#define HB_GLYF_MAX_POINTS 10000
#endif
enum phantom_point_index_t
{
PHANTOM_LEFT = 0,
@ -313,6 +318,9 @@ struct Glyph
for (unsigned int i = 0; i < PHANTOM_COUNT; i++)
phantoms[i] = comp_points[comp_points.length - PHANTOM_COUNT + i];
if (all_points.length > HB_GLYF_MAX_POINTS)
return false;
all_points.extend (comp_points.sub_array (0, comp_points.length - PHANTOM_COUNT));
comp_index++;