summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaichi Haradaguchi <20001722@ymail.ne.jp>2023-03-11 12:42:40 +0900
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2023-04-13 20:38:03 +0200
commitcd57142b73d438251d147b6bfe49c1c050bbbb14 (patch)
tree0d1a822a21288a843b7263135aea526dd9a930f8
parentUpdate git submodules (diff)
downloadcore-cd57142b73d438251d147b6bfe49c1c050bbbb14.tar.gz
core-cd57142b73d438251d147b6bfe49c1c050bbbb14.zip
Upgrade Harfbuzz to 7.1.0
* Fixes CVE-2023-25193. * if Harfbuzz >= 7.0.0, uses hb_font_draw_glyph() instead of hb_font_get_glyph_shape(). * Update URL in README. Change-Id: Id234c2b459c40ddac340731b44889b104e03a1e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148759 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--download.lst4
-rw-r--r--external/harfbuzz/0001-PairPos-Another-attempt-at-fixing-unsafe-to-break-wi.patch.162
-rw-r--r--external/harfbuzz/0001-buffer-diff-Fix-check-for-glyph-flag-equality.patch.165
-rw-r--r--external/harfbuzz/0001-font-Respect-subfont-slant-setting-in-hb-draw.patch.1104
-rw-r--r--external/harfbuzz/0001-hb-view-Fix-cairo-slanting-condition.patch.129
-rw-r--r--external/harfbuzz/3874.patch.147
-rw-r--r--external/harfbuzz/README2
-rw-r--r--external/harfbuzz/UnpackedTarball_harfbuzz.mk6
-rw-r--r--vcl/source/font/LogicalFontInstance.cxx4
9 files changed, 7 insertions, 316 deletions
diff --git a/download.lst b/download.lst
index 274fe1ebe91d..22a309ae0a8b 100644
--- a/download.lst
+++ b/download.lst
@@ -218,8 +218,8 @@ GRAPHITE_TARBALL := graphite2-minimal-1.3.14.tgz
# three static lines
# so that git cherry-pick
# will not run into conflicts
-HARFBUZZ_SHA256SUM := 735a94917b47936575acb4d4fa7e7986522f8a89527e4635721474dee2bc942c
-HARFBUZZ_TARBALL := harfbuzz-5.2.0.tar.xz
+HARFBUZZ_SHA256SUM := f135a61cd464c9ed6bc9823764c188f276c3850a8dc904628de2a87966b7077b
+HARFBUZZ_TARBALL := harfbuzz-7.1.0.tar.xz
# three static lines
# so that git cherry-pick
# will not run into conflicts
diff --git a/external/harfbuzz/0001-PairPos-Another-attempt-at-fixing-unsafe-to-break-wi.patch.1 b/external/harfbuzz/0001-PairPos-Another-attempt-at-fixing-unsafe-to-break-wi.patch.1
deleted file mode 100644
index 0fd429257b8d..000000000000
--- a/external/harfbuzz/0001-PairPos-Another-attempt-at-fixing-unsafe-to-break-wi.patch.1
+++ /dev/null
@@ -1,62 +0,0 @@
-From 05aa084e67705285941c9acd13151e2a38da8b0f Mon Sep 17 00:00:00 2001
-From: Behdad Esfahbod <behdad@behdad.org>
-Date: Thu, 24 Nov 2022 12:13:31 -0700
-Subject: [PATCH] [PairPos] Another attempt at fixing unsafe-to-break with
- ValueFormat2
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Fixes https://github.com/harfbuzz/harfbuzz/issues/3888#issuecomment-1326781116
-
-Test:
-$ hb-shape XBRoya34.ttf ' الأ' --show-flags --script=arab
----
- src/OT/Layout/GPOS/PairPosFormat2.hh | 9 +++++----
- src/OT/Layout/GPOS/PairSet.hh | 5 +++--
- 2 files changed, 8 insertions(+), 6 deletions(-)
-
-diff --git a/src/OT/Layout/GPOS/PairPosFormat2.hh b/src/OT/Layout/GPOS/PairPosFormat2.hh
-index 1bb0d60ae..523e0e936 100644
---- a/src/OT/Layout/GPOS/PairPosFormat2.hh
-+++ b/src/OT/Layout/GPOS/PairPosFormat2.hh
-@@ -241,15 +241,16 @@ struct PairPosFormat2_4
- boring:
- buffer->unsafe_to_concat (buffer->idx, skippy_iter.idx + 1);
-
--
-- buffer->idx = skippy_iter.idx;
- if (len2)
- {
-- buffer->idx++;
-+ skippy_iter.idx++;
- // https://github.com/harfbuzz/harfbuzz/issues/3824
-- buffer->unsafe_to_break (buffer->idx - 1, buffer->idx + 1);
-+ // https://github.com/harfbuzz/harfbuzz/issues/3888#issuecomment-1326781116
-+ buffer->unsafe_to_break (buffer->idx, skippy_iter.idx + 1);
- }
-
-+ buffer->idx = skippy_iter.idx;
-+
- return_trace (true);
- }
-
-diff --git a/src/OT/Layout/GPOS/PairSet.hh b/src/OT/Layout/GPOS/PairSet.hh
-index b1d9f83bc..2ad1f004c 100644
---- a/src/OT/Layout/GPOS/PairSet.hh
-+++ b/src/OT/Layout/GPOS/PairSet.hh
-@@ -132,8 +132,9 @@ struct PairSet
- if (len2)
- {
- pos++;
-- // https://github.com/harfbuzz/harfbuzz/issues/3824
-- buffer->unsafe_to_break (pos - 1, pos + 1);
-+ // https://github.com/harfbuzz/harfbuzz/issues/3824
-+ // https://github.com/harfbuzz/harfbuzz/issues/3888#issuecomment-1326781116
-+ buffer->unsafe_to_break (buffer->idx, pos + 1);
- }
-
- buffer->idx = pos;
---
-2.38.1
-
diff --git a/external/harfbuzz/0001-buffer-diff-Fix-check-for-glyph-flag-equality.patch.1 b/external/harfbuzz/0001-buffer-diff-Fix-check-for-glyph-flag-equality.patch.1
deleted file mode 100644
index 45da1bddf161..000000000000
--- a/external/harfbuzz/0001-buffer-diff-Fix-check-for-glyph-flag-equality.patch.1
+++ /dev/null
@@ -1,65 +0,0 @@
-From 404cb99d86c2d639b4ce2fc59f00f5e66468af34 Mon Sep 17 00:00:00 2001
-From: Behdad Esfahbod <behdad@behdad.org>
-Date: Wed, 23 Nov 2022 15:35:14 -0700
-Subject: [PATCH] [buffer-diff] Fix check for glyph flag equality
-
-I'm not sure if the old behavior was intentional, but it was checking
-that the glyph flags were a subset of the reference buffer's glyph
-flags. I don't see why that is useful. Fix that.
-
-Then make the buffer-verify code ignore flag differences when verifying
-buffers, since our unsafe-to-concat flag at least, is conservative and
-not guaranteed to be produced the same in fragments. See:
-
-https://github.com/harfbuzz/harfbuzz/issues/3888
----
- src/hb-buffer-verify.cc | 5 ++---
- src/hb-buffer.cc | 2 +-
- 2 files changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/src/hb-buffer-verify.cc b/src/hb-buffer-verify.cc
-index 5453e1ca9..1cd52b39b 100644
---- a/src/hb-buffer-verify.cc
-+++ b/src/hb-buffer-verify.cc
-@@ -186,7 +186,7 @@ buffer_verify_unsafe_to_break (hb_buffer_t *buffer,
-
- bool ret = true;
- hb_buffer_diff_flags_t diff = hb_buffer_diff (reconstruction, buffer, (hb_codepoint_t) -1, 0);
-- if (diff)
-+ if (diff & ~HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH)
- {
- buffer_verify_error (buffer, font, BUFFER_VERIFY_ERROR "unsafe-to-break test failed.");
- ret = false;
-@@ -313,7 +313,6 @@ buffer_verify_unsafe_to_concat (hb_buffer_t *buffer,
-
- bool ret = true;
- hb_buffer_diff_flags_t diff;
--
- /*
- * Shape the two fragment streams.
- */
-@@ -382,7 +381,7 @@ buffer_verify_unsafe_to_concat (hb_buffer_t *buffer,
- * Diff results.
- */
- diff = hb_buffer_diff (reconstruction, buffer, (hb_codepoint_t) -1, 0);
-- if (diff)
-+ if (diff & ~HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH)
- {
- buffer_verify_error (buffer, font, BUFFER_VERIFY_ERROR "unsafe-to-concat test failed.");
- ret = false;
-diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
-index f1e30f241..9e67e680c 100644
---- a/src/hb-buffer.cc
-+++ b/src/hb-buffer.cc
-@@ -2095,7 +2095,7 @@ hb_buffer_diff (hb_buffer_t *buffer,
- result |= HB_BUFFER_DIFF_FLAG_CODEPOINT_MISMATCH;
- if (buf_info->cluster != ref_info->cluster)
- result |= HB_BUFFER_DIFF_FLAG_CLUSTER_MISMATCH;
-- if ((buf_info->mask & ~ref_info->mask & HB_GLYPH_FLAG_DEFINED))
-+ if ((buf_info->mask ^ ref_info->mask) & HB_GLYPH_FLAG_DEFINED)
- result |= HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH;
- if (contains && ref_info->codepoint == dottedcircle_glyph)
- result |= HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT;
---
-2.38.1
-
diff --git a/external/harfbuzz/0001-font-Respect-subfont-slant-setting-in-hb-draw.patch.1 b/external/harfbuzz/0001-font-Respect-subfont-slant-setting-in-hb-draw.patch.1
deleted file mode 100644
index 43ed88221669..000000000000
--- a/external/harfbuzz/0001-font-Respect-subfont-slant-setting-in-hb-draw.patch.1
+++ /dev/null
@@ -1,104 +0,0 @@
-From 060ecac949dca29a75538ddeedf015441296334b Mon Sep 17 00:00:00 2001
-From: Behdad Esfahbod <behdad@behdad.org>
-Date: Wed, 23 Nov 2022 16:31:37 -0700
-Subject: [PATCH] [font] Respect subfont slant setting in hb-draw
-
-Fixes https://github.com/harfbuzz/harfbuzz/issues/3890
----
- src/hb-font.cc | 34 ++++++++++++++++++++--------------
- 1 file changed, 20 insertions(+), 14 deletions(-)
-
-diff --git a/src/hb-font.cc b/src/hb-font.cc
-index 93005f4f3..e1699ca2a 100644
---- a/src/hb-font.cc
-+++ b/src/hb-font.cc
-@@ -518,6 +518,7 @@ typedef struct hb_font_get_glyph_shape_default_adaptor_t {
- void *draw_data;
- float x_scale;
- float y_scale;
-+ float slant;
- } hb_font_get_glyph_shape_default_adaptor_t;
-
- static void
-@@ -530,9 +531,10 @@ hb_draw_move_to_default (hb_draw_funcs_t *dfuncs HB_UNUSED,
- hb_font_get_glyph_shape_default_adaptor_t *adaptor = (hb_font_get_glyph_shape_default_adaptor_t *) draw_data;
- float x_scale = adaptor->x_scale;
- float y_scale = adaptor->y_scale;
-+ float slant = adaptor->slant;
-
- adaptor->draw_funcs->emit_move_to (adaptor->draw_data, *st,
-- x_scale * to_x, y_scale * to_y);
-+ x_scale * to_x + slant * to_y, y_scale * to_y);
- }
-
- static void
-@@ -544,12 +546,13 @@ hb_draw_line_to_default (hb_draw_funcs_t *dfuncs HB_UNUSED, void *draw_data,
- hb_font_get_glyph_shape_default_adaptor_t *adaptor = (hb_font_get_glyph_shape_default_adaptor_t *) draw_data;
- float x_scale = adaptor->x_scale;
- float y_scale = adaptor->y_scale;
-+ float slant = adaptor->slant;
-
-- st->current_x *= x_scale;
-- st->current_y *= y_scale;
-+ st->current_x = st->current_x * x_scale + st->current_y * slant;
-+ st->current_y = st->current_y * y_scale;
-
- adaptor->draw_funcs->emit_line_to (adaptor->draw_data, *st,
-- x_scale * to_x, y_scale * to_y);
-+ x_scale * to_x + slant * to_y, y_scale * to_y);
- }
-
- static void
-@@ -562,13 +565,14 @@ hb_draw_quadratic_to_default (hb_draw_funcs_t *dfuncs HB_UNUSED, void *draw_data
- hb_font_get_glyph_shape_default_adaptor_t *adaptor = (hb_font_get_glyph_shape_default_adaptor_t *) draw_data;
- float x_scale = adaptor->x_scale;
- float y_scale = adaptor->y_scale;
-+ float slant = adaptor->slant;
-
-- st->current_x *= x_scale;
-- st->current_y *= y_scale;
-+ st->current_x = st->current_x * x_scale + st->current_y * slant;
-+ st->current_y = st->current_y * y_scale;
-
- adaptor->draw_funcs->emit_quadratic_to (adaptor->draw_data, *st,
-- x_scale * control_x, y_scale * control_y,
-- x_scale * to_x, y_scale * to_y);
-+ x_scale * control_x + slant * control_y, y_scale * control_y,
-+ x_scale * to_x + slant * to_y, y_scale * to_y);
- }
-
- static void
-@@ -582,14 +586,15 @@ hb_draw_cubic_to_default (hb_draw_funcs_t *dfuncs HB_UNUSED, void *draw_data,
- hb_font_get_glyph_shape_default_adaptor_t *adaptor = (hb_font_get_glyph_shape_default_adaptor_t *) draw_data;
- float x_scale = adaptor->x_scale;
- float y_scale = adaptor->y_scale;
-+ float slant = adaptor->slant;
-
-- st->current_x *= x_scale;
-- st->current_y *= y_scale;
-+ st->current_x = st->current_x * x_scale + st->current_y * slant;
-+ st->current_y = st->current_y * y_scale;
-
- adaptor->draw_funcs->emit_cubic_to (adaptor->draw_data, *st,
-- x_scale * control1_x, y_scale * control1_y,
-- x_scale * control2_x, y_scale * control2_y,
-- x_scale * to_x, y_scale * to_y);
-+ x_scale * control1_x + slant * control1_y, y_scale * control1_y,
-+ x_scale * control2_x + slant * control2_y, y_scale * control2_y,
-+ x_scale * to_x + slant * to_y, y_scale * to_y);
- }
-
- static void
-@@ -624,7 +629,8 @@ hb_font_get_glyph_shape_default (hb_font_t *font,
- draw_funcs,
- draw_data,
- (float) font->x_scale / (float) font->parent->x_scale,
-- (float) font->y_scale / (float) font->parent->y_scale
-+ (float) font->y_scale / (float) font->parent->y_scale,
-+ (font->slant - font->parent->slant) * (float) font->x_scale / (float) font->parent->y_scale
- };
-
- font->parent->get_glyph_shape (glyph,
---
-2.38.1
-
diff --git a/external/harfbuzz/0001-hb-view-Fix-cairo-slanting-condition.patch.1 b/external/harfbuzz/0001-hb-view-Fix-cairo-slanting-condition.patch.1
deleted file mode 100644
index b76c58eaec8c..000000000000
--- a/external/harfbuzz/0001-hb-view-Fix-cairo-slanting-condition.patch.1
+++ /dev/null
@@ -1,29 +0,0 @@
-From 2e9b270a496de14d3eee9d8b7e1372293bf13888 Mon Sep 17 00:00:00 2001
-From: Behdad Esfahbod <behdad@behdad.org>
-Date: Wed, 23 Nov 2022 16:17:50 -0700
-Subject: [PATCH] [hb-view] Fix cairo slanting condition
-
-hb-draw already does slanting. If NOT hb-draw, we should slant
-through cairo path. Donno why this was untested before.
-
-This was double-slanting with hb-draw, and not slanting without it.
----
- util/helper-cairo.hh | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh
-index 37bde1896..fbdbbb1db 100644
---- a/util/helper-cairo.hh
-+++ b/util/helper-cairo.hh
-@@ -104,7 +104,7 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts)
- cairo_matrix_init_scale (&font_matrix,
- font_opts->font_size_x,
- font_opts->font_size_y);
-- if (use_hb_draw)
-+ if (!use_hb_draw)
- font_matrix.xy = -font_opts->slant * font_opts->font_size_x;
-
- font_options = cairo_font_options_create ();
---
-2.38.1
-
diff --git a/external/harfbuzz/3874.patch.1 b/external/harfbuzz/3874.patch.1
deleted file mode 100644
index 74dd91086ad6..000000000000
--- a/external/harfbuzz/3874.patch.1
+++ /dev/null
@@ -1,47 +0,0 @@
-From 26efeceefab9c45b080c3636daaf9452779c79c7 Mon Sep 17 00:00:00 2001
-From: Behdad Esfahbod <behdad@behdad.org>
-Date: Fri, 11 Nov 2022 12:45:12 -0700
-Subject: [PATCH] [GPOS.PairPos] Adjust unsafe-to-break for non-zero
- ValueFormat2
-
-Fixes https://github.com/harfbuzz/harfbuzz/issues/3824
----
- src/OT/Layout/GPOS/PairPosFormat2.hh | 4 ++++
- src/OT/Layout/GPOS/PairSet.hh | 7 ++++++-
- 2 files changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/src/OT/Layout/GPOS/PairPosFormat2.hh b/src/OT/Layout/GPOS/PairPosFormat2.hh
-index 83b093b988..1bb0d60ae2 100644
---- a/src/OT/Layout/GPOS/PairPosFormat2.hh
-+++ b/src/OT/Layout/GPOS/PairPosFormat2.hh
-@@ -244,7 +244,11 @@ struct PairPosFormat2_4
-
- buffer->idx = skippy_iter.idx;
- if (len2)
-+ {
- buffer->idx++;
-+ // https://github.com/harfbuzz/harfbuzz/issues/3824
-+ buffer->unsafe_to_break (buffer->idx - 1, buffer->idx + 1);
-+ }
-
- return_trace (true);
- }
-diff --git a/src/OT/Layout/GPOS/PairSet.hh b/src/OT/Layout/GPOS/PairSet.hh
-index aa48d933c3..b1d9f83bc9 100644
---- a/src/OT/Layout/GPOS/PairSet.hh
-+++ b/src/OT/Layout/GPOS/PairSet.hh
-@@ -128,8 +128,13 @@ struct PairSet
-
- if (applied_first || applied_second)
- buffer->unsafe_to_break (buffer->idx, pos + 1);
-+
- if (len2)
-- pos++;
-+ {
-+ pos++;
-+ // https://github.com/harfbuzz/harfbuzz/issues/3824
-+ buffer->unsafe_to_break (pos - 1, pos + 1);
-+ }
-
- buffer->idx = pos;
- return_trace (true);
diff --git a/external/harfbuzz/README b/external/harfbuzz/README
index d2af8b559ad1..149da5566ab9 100644
--- a/external/harfbuzz/README
+++ b/external/harfbuzz/README
@@ -1 +1 @@
-HarfBuzz is an OpenType text shaping engine. From [http://harfbuzz.org/].
+HarfBuzz is an OpenType text shaping engine. From [https://harfbuzz.github.io/].
diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index 4b97fa208c5b..9bc9e326b426 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -15,13 +15,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,harfbuzz))
$(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
-# <https://github.com/harfbuzz/harfbuzz/pull/3874> "Adjust unsafe-to-break for non-zero ValueFormat2":
$(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
- external/harfbuzz/3874.patch.1 \
- external/harfbuzz/0001-hb-view-Fix-cairo-slanting-condition.patch.1 \
- external/harfbuzz/0001-font-Respect-subfont-slant-setting-in-hb-draw.patch.1 \
- external/harfbuzz/0001-buffer-diff-Fix-check-for-glyph-flag-equality.patch.1 \
- external/harfbuzz/0001-PairPos-Another-attempt-at-fixing-unsafe-to-break-wi.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/vcl/source/font/LogicalFontInstance.cxx b/vcl/source/font/LogicalFontInstance.cxx
index 58b291d04bdf..6c7a7e2bde09 100644
--- a/vcl/source/font/LogicalFontInstance.cxx
+++ b/vcl/source/font/LogicalFontInstance.cxx
@@ -306,7 +306,11 @@ bool LogicalFontInstance::GetGlyphOutlineUntransformed(sal_GlyphId nGlyph,
hb_draw_funcs_set_close_path_func(m_pHbDrawFuncs, close_path_func, pUserData, nullptr);
}
+#if HB_VERSION_ATLEAST(7, 0, 0)
+ hb_font_draw_glyph(GetHbFontUntransformed(), nGlyph, m_pHbDrawFuncs, &rPolyPoly);
+#else
hb_font_get_glyph_shape(GetHbFontUntransformed(), nGlyph, m_pHbDrawFuncs, &rPolyPoly);
+#endif
return true;
}