From 462daf615edfe9b9bb86a8a13749493b594ea878 Mon Sep 17 00:00:00 2001 From: ZacohZhen Date: Sat, 7 Mar 2026 09:35:08 +0800 Subject: [PATCH] Disallow hb_buffer_set_message_func during callback Signed-off-by: ZacohZhen --- backport-harfbuzz-disallow-during-callback.patch | 14 ++++++++++++++ install.py | 6 ++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 backport-harfbuzz-disallow-during-callback.patch diff --git a/backport-harfbuzz-disallow-during-callback.patch b/backport-harfbuzz-disallow-during-callback.patch new file mode 100644 index 000000000..b1d6ebf2b --- /dev/null +++ b/backport-harfbuzz-disallow-during-callback.patch @@ -0,0 +1,14 @@ +diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc +index 7fb95fe..ce737ce 100644 +--- a/src/hb-buffer.cc ++++ b/src/hb-buffer.cc +@@ -2271,7 +2271,8 @@ hb_buffer_set_message_func (hb_buffer_t *buffer, + hb_buffer_message_func_t func, + void *user_data, hb_destroy_func_t destroy) + { +- if (unlikely (hb_object_is_immutable (buffer))) ++ if (unlikely (hb_object_is_immutable (buffer)) || ++ unlikely (buffer->message_depth)) + { + if (destroy) + destroy (user_data); diff --git a/install.py b/install.py index bbebd00b2..60bc0de7f 100755 --- a/install.py +++ b/install.py @@ -33,7 +33,8 @@ def untar_file(tar_file_path, extract_path): def move_file(src_path, dst_path): files = [ "huawei_harfbuzz.patch", - "CVE-2026-22693.patch" + "CVE-2026-22693.patch", + "backport-harfbuzz-disallow-during-callback.patch" ] for file in files: src_file = os.path.join(src_path, file) @@ -55,7 +56,8 @@ def apply_patch(patch_file, target_dir): def do_patch(target_dir): patch_file = [ "huawei_harfbuzz.patch", - "CVE-2026-22693.patch" + "CVE-2026-22693.patch", + "backport-harfbuzz-disallow-during-callback.patch" ] for patch in patch_file: