external/harfbuzz/UnpackedTarball_harfbuzz.mk |    1 
 external/harfbuzz/tdf159529.patch.0           |   28 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

New commits:
commit 618e977e7f6973bf36bf83c04f7802cb83f8064a
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Tue Feb 20 19:06:04 2024 -0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Feb 22 17:53:31 2024 +0100

    tdf#159529 clear hb_ot_face_t data after fetching 'sbix' and 'glyf' tables
    
    The 'sbix' and 'glyf' tables can be very large for color emoji fonts
    so clear any cached data in hb_ot_face_t after fetching that table's
    extents.
    
    Change-Id: Id5deda9114b7199a4194ff16879e5791acd1cd82
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163674
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit af47a78e11d4819bb4b1ae1a1277babd10d815b7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163620
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk 
b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index 9bc9e326b426..71627725fae7 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -16,6 +16,7 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,harfbuzz))
 $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
 
 $(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
+    external/harfbuzz/tdf159529.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/harfbuzz/tdf159529.patch.0 
b/external/harfbuzz/tdf159529.patch.0
new file mode 100644
index 000000000000..d76313ce83be
--- /dev/null
+++ b/external/harfbuzz/tdf159529.patch.0
@@ -0,0 +1,28 @@
+--- ./src/hb-ot-font.cc        2023-11-11 09:08:45
++++ ./src/hb-ot-font.cc        2024-02-20 18:53:55
+@@ -428,13 +428,23 @@
+   const hb_ot_face_t *ot_face = ot_font->ot_face;
+ 
+ #if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR)
+-  if (ot_face->sbix->get_extents (font, glyph, extents)) return true;
++  /* tdf#159529 clear the hb_ot_face_t's data after fetching 'sbix' table
++   * The 'sbix' table can be very large for color emoji fonts so clear any
++   * cached data in hb_ot_face_t after fetching that table's extents. */
++  bool sbixResult = ot_face->sbix->get_extents (font, glyph, extents);
++  const_cast<hb_ot_face_t*>(ot_face)->sbix.fini ();
++  if (sbixResult) return true;
+   if (ot_face->CBDT->get_extents (font, glyph, extents)) return true;
+ #endif
+ #if !defined(HB_NO_COLOR) && !defined(HB_NO_PAINT)
+   if (ot_face->COLR->get_extents (font, glyph, extents)) return true;
+ #endif
+-  if (ot_face->glyf->get_extents (font, glyph, extents)) return true;
++  /* tdf#159529 clear the hb_ot_face_t's data after fetching 'glyf' table
++   * The 'glyf' table can be very large for color emoji fonts so clear any
++   * cached data in hb_ot_face_t after fetching that table's extents. */
++  bool glyfResult = ot_face->glyf->get_extents (font, glyph, extents);
++  const_cast<hb_ot_face_t*>(ot_face)->glyf.fini ();
++  if (glyfResult) return true;
+ #ifndef HB_NO_OT_FONT_CFF
+   if (ot_face->cff2->get_extents (font, glyph, extents)) return true;
+   if (ot_face->cff1->get_extents (font, glyph, extents)) return true;

Reply via email to