From 477d71724c945c9f1b4ca8a569be1cc5c5f93dcb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Oct 2022 13:11:47 -0600 Subject: [PATCH] [glyf] Limit points in a glyf to 10000 roughly Only enforced when components are being expanded. Fixes https://github.com/harfbuzz/harfbuzz/issues/3838 --- src/OT/glyf/Glyph.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index 0b25659ac..f8366ce3a 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -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++;