From 95afc17a88f21b9b0d78410b06b3da8d1b3875bb Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Thu, 3 Aug 2023 02:50:52 +0000 Subject: harfbuzz 8.1.1 git-svn-id: svn://tug.org/texlive/trunk@67801 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/README | 4 +- Build/source/libs/harfbuzz/ChangeLog | 5 + Build/source/libs/harfbuzz/TLpatches/ChangeLog | 5 + Build/source/libs/harfbuzz/TLpatches/TL-Changes | 4 +- Build/source/libs/harfbuzz/configure | 24 +-- Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog | 223 +++++++++++++++++++++ Build/source/libs/harfbuzz/harfbuzz-src/NEWS | 8 + .../source/libs/harfbuzz/harfbuzz-src/configure.ac | 2 +- .../source/libs/harfbuzz/harfbuzz-src/meson.build | 2 +- .../src/OT/Layout/GPOS/CursivePosFormat1.hh | 16 +- .../src/OT/Layout/GPOS/MarkMarkPosFormat1.hh | 2 +- .../src/OT/Layout/GPOS/PairPosFormat1.hh | 2 +- .../src/OT/Layout/GPOS/PairPosFormat2.hh | 2 +- .../harfbuzz-src/src/OT/Layout/GSUB/LigatureSet.hh | 2 +- .../libs/harfbuzz/harfbuzz-src/src/graph/graph.hh | 58 ++++-- .../libs/harfbuzz/harfbuzz-src/src/hb-kern.hh | 2 +- .../harfbuzz-src/src/hb-ot-layout-gsubgpos.hh | 39 ++-- .../libs/harfbuzz/harfbuzz-src/src/hb-sanitize.hh | 3 + Build/source/libs/harfbuzz/version.ac | 2 +- 19 files changed, 336 insertions(+), 69 deletions(-) (limited to 'Build') diff --git a/Build/source/libs/README b/Build/source/libs/README index d1bdf1de56c..67cc781f50d 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -25,8 +25,8 @@ graphite2 1.3.14 - checked 10apr20 http://sourceforge.net/projects/silgraphite/files/graphite2/ (requires C++11) -harfbuzz 8.1.0 - checked 01aug23 - https://github.com/harfbuzz/harfbuzz/releases/tag/8.1.0 +harfbuzz 8.1.1 - checked 03aug23 + https://github.com/harfbuzz/harfbuzz/releases/tag/8.1.1 icu 72.1 - checked 07jan23 https://github.com/unicode-org/icu/releases/ diff --git a/Build/source/libs/harfbuzz/ChangeLog b/Build/source/libs/harfbuzz/ChangeLog index 6f2fc25df71..435ee883232 100644 --- a/Build/source/libs/harfbuzz/ChangeLog +++ b/Build/source/libs/harfbuzz/ChangeLog @@ -1,3 +1,8 @@ +2023-08-03 Akira Kakuto + + Import harfbuzz-8.1.1. + * version.ac: Adjusted. + 2023-08-01 Akira Kakuto Import harfbuzz-8.1.0. diff --git a/Build/source/libs/harfbuzz/TLpatches/ChangeLog b/Build/source/libs/harfbuzz/TLpatches/ChangeLog index 79d66a1d2bc..3fb6ef3a444 100644 --- a/Build/source/libs/harfbuzz/TLpatches/ChangeLog +++ b/Build/source/libs/harfbuzz/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2023-08-03 Akira Kakuto + + Imported harfbuzz-8.1.1 source tree from: + https://github.com/harfbuzz/harfbuzz/releases/download/8.1.1/ + 2023-08-01 Akira Kakuto Imported harfbuzz-8.1.0 source tree from: diff --git a/Build/source/libs/harfbuzz/TLpatches/TL-Changes b/Build/source/libs/harfbuzz/TLpatches/TL-Changes index ce9d977f31e..c64947e5988 100644 --- a/Build/source/libs/harfbuzz/TLpatches/TL-Changes +++ b/Build/source/libs/harfbuzz/TLpatches/TL-Changes @@ -1,5 +1,5 @@ -Changes applied to the harfbuzz-8.1.0/ tree as obtained from: - https://github.com/harfbuzz/harfbuzz/releases/download/8.1.0/ +Changes applied to the harfbuzz-8.1.1/ tree as obtained from: + https://github.com/harfbuzz/harfbuzz/releases/download/8.1.1/ Removed: COPYING diff --git a/Build/source/libs/harfbuzz/configure b/Build/source/libs/harfbuzz/configure index 6be5d151aff..90404b9eeff 100755 --- a/Build/source/libs/harfbuzz/configure +++ b/Build/source/libs/harfbuzz/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for harfbuzz (TeX Live) 8.1.0. +# Generated by GNU Autoconf 2.71 for harfbuzz (TeX Live) 8.1.1. # # Report bugs to . # @@ -611,8 +611,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='harfbuzz (TeX Live)' PACKAGE_TARNAME='harfbuzz--tex-live-' -PACKAGE_VERSION='8.1.0' -PACKAGE_STRING='harfbuzz (TeX Live) 8.1.0' +PACKAGE_VERSION='8.1.1' +PACKAGE_STRING='harfbuzz (TeX Live) 8.1.1' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1346,7 +1346,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures harfbuzz (TeX Live) 8.1.0 to adapt to many kinds of systems. +\`configure' configures harfbuzz (TeX Live) 8.1.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1418,7 +1418,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of harfbuzz (TeX Live) 8.1.0:";; + short | recursive ) echo "Configuration of harfbuzz (TeX Live) 8.1.1:";; esac cat <<\_ACEOF @@ -1523,7 +1523,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -harfbuzz (TeX Live) configure 8.1.0 +harfbuzz (TeX Live) configure 8.1.1 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2064,7 +2064,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by harfbuzz (TeX Live) $as_me 8.1.0, which was +It was created by harfbuzz (TeX Live) $as_me 8.1.1, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -4823,7 +4823,7 @@ fi # Define the identity of the package. PACKAGE='harfbuzz--tex-live-' - VERSION='8.1.0' + VERSION='8.1.1' # Some tools Automake needs. @@ -5035,8 +5035,8 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags HB_VERSION_MAJOR=8 HB_VERSION_MINOR=1 -HB_VERSION_MICRO=0 -HB_VERSION=8.1.0 +HB_VERSION_MICRO=1 +HB_VERSION=8.1.1 ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -8817,7 +8817,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by harfbuzz (TeX Live) $as_me 8.1.0, which was +This file was extended by harfbuzz (TeX Live) $as_me 8.1.1, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8885,7 +8885,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -harfbuzz (TeX Live) config.status 8.1.0 +harfbuzz (TeX Live) config.status 8.1.1 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog index 4ed4469f0d9..5641d060e88 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog +++ b/Build/source/libs/harfbuzz/harfbuzz-src/ChangeLog @@ -1,3 +1,226 @@ +commit 1d665c2b521512cdd56964138fc601debd1f1177 +Author: Khaled Hosny +Date: Wed Aug 2 23:44:56 2023 +0300 + + 8.1.1 + + NEWS | 8 ++++++++ + configure.ac | 2 +- + meson.build | 2 +- + src/hb-version.h | 4 ++-- + 4 files changed, 12 insertions(+), 4 deletions(-) + +commit 91c449a64a6924afd2aee4d3eb0b80c8c7d9ad07 +Author: Behdad Esfahbod +Date: Wed Aug 2 14:40:55 2023 -0600 + + [graph] Make space_for non-recursive + + It was tail-recursive so perhaps the compiler did the same. + Anyway, make it explicit now. + + src/graph/graph.hh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +commit dcd3afcabfeb447a075b189f20cd523e177a0a9d +Author: Behdad Esfahbod +Date: Tue Aug 1 20:09:34 2023 -0600 + + [skippy-iter] Remove unused num_items + + src/OT/Layout/GPOS/CursivePosFormat1.hh | 2 +- + src/OT/Layout/GPOS/MarkMarkPosFormat1.hh | 2 +- + src/OT/Layout/GPOS/PairPosFormat1.hh | 2 +- + src/OT/Layout/GPOS/PairPosFormat2.hh | 2 +- + src/OT/Layout/GSUB/LigatureSet.hh | 2 +- + src/hb-kern.hh | 2 +- + src/hb-ot-layout-gsubgpos.hh | 24 +++++++----------------- + 7 files changed, 13 insertions(+), 23 deletions(-) + +commit 5b337130e28eeaef3b5cfe884b514059417e3384 +Author: Behdad Esfahbod +Date: Tue Aug 1 20:02:21 2023 -0600 + + Add test for previous commit + + .../fonts/bef923f4ccb474f961c43b63a9c74b7d9b7a023f.ttf | Bin 0 -> 2180 bytes + test/shape/data/in-house/tests/context-matching.tests | 1 + + 2 files changed, 1 insertion(+) + +commit 39048099cb421095e24cdcc027b9cdc2a7fcf93e +Author: Behdad Esfahbod +Date: Tue Aug 1 19:41:12 2023 -0600 + + [skippy-iter] Remove early stop + + The optimization in (Chain)RuleSet matching relies on + matching one, even if num_items is out of range. + + Fixes https://github.com/harfbuzz/harfbuzz/issues/4358 + + src/hb-ot-layout-gsubgpos.hh | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +commit 70b3fbed2850f310658b65a68a058232b78ebeee +Author: Behdad Esfahbod +Date: Tue Aug 1 15:16:16 2023 -0600 + + [graph] Fix invalid read when map gets resized + + I don't fully understand how the old code was wrong, since + *v should be evaluated before the set() method call. + Yet this seems to fix a bug that could be reproduced + with HB_DEBUG_SUBSET_REPACK enabled and the following: + + $ hb-repacker-fuzzer test/fuzzing/graphs/clusterfuzz-testcase-minimized-hb-repacker-fuzzer-6419865171525632 + + src/graph/graph.hh | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +commit 94d4283b12037d66ceb3b195f47d3bca96eb6627 +Author: Behdad Esfahbod +Date: Tue Aug 1 15:05:17 2023 -0600 + + [graph] Handle a malloc fail + + Fixes https://oss-fuzz.com/testcase-detail/4579249263345664 + + src/graph/graph.hh | 19 ++++++++++++------- + ...ase-minimized-hb-repacker-fuzzer-4579249263345664 | Bin 0 -> 173466 bytes + 2 files changed, 12 insertions(+), 7 deletions(-) + +commit 603920e911dc0fde79dc0ddde2be393f5c123d30 +Author: Behdad Esfahbod +Date: Tue Aug 1 14:58:33 2023 -0600 + + [graph] Minor asserts + + src/graph/graph.hh | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +commit 8d00476fbf99f770608644e424712cf95d3950b8 +Author: Behdad Esfahbod +Date: Tue Aug 1 14:27:37 2023 -0600 + + [graph] Minor restructure a condition + + src/graph/graph.hh | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +commit 7946984b9624338b8d15fa53ac21664a734e93d3 +Author: Behdad Esfahbod +Date: Tue Aug 1 14:18:03 2023 -0600 + + [graph] More assert + + src/graph/graph.hh | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +commit 3b386c3773f24e30ec26bbbf86422ac67a6fb7b9 +Author: Behdad Esfahbod +Date: Tue Aug 1 14:12:43 2023 -0600 + + [graph] Minor assert + + src/graph/graph.hh | 4 ++++ + 1 file changed, 4 insertions(+) + +commit 07e7033076d9acfeeaa7a91ea878fa130a022824 +Author: Behdad Esfahbod +Date: Tue Aug 1 12:25:45 2023 -0600 + + [graph] Error check + + src/graph/graph.hh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 7a9aac1ae3f7b836ddb314636d6f50d8ad7ec5d2 +Author: Behdad Esfahbod +Date: Tue Aug 1 12:05:22 2023 -0600 + + [graph] Fixes to parent handling + + src/graph/graph.hh | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +commit 2feac50b40f1dff06655c8efcadcc55088b34dad +Author: Behdad Esfahbod +Date: Mon Jul 31 19:53:06 2023 -0600 + + Revert "[gsubgpos] Keep another digest in the applicable_t" + + This reverts commit fd79c7cecdf68fe4626943f29bd5edf1e603d2b2. + + src/hb-ot-layout-gsubgpos.hh | 32 ++++++++++---------------------- + 1 file changed, 10 insertions(+), 22 deletions(-) + +commit fd79c7cecdf68fe4626943f29bd5edf1e603d2b2 +Author: Behdad Esfahbod +Date: Mon Jul 31 19:52:15 2023 -0600 + + [gsubgpos] Keep another digest in the applicable_t + + The digest for all the remaining subtables combined. + The idea is to get out of the subtable look as soon as + no more can be applied. + + Doesn't seem to speed up anything I tested. Going to revert. + + src/hb-ot-layout-gsubgpos.hh | 32 ++++++++++++++++++++++---------- + 1 file changed, 22 insertions(+), 10 deletions(-) + +commit e3fd69c88958fead68a62cecef7454990f7757fd +Author: Behdad Esfahbod +Date: Mon Jul 31 19:07:42 2023 -0600 + + [layout] Inline another function + + Code is smaller too. + + src/hb-ot-layout-gsubgpos.hh | 3 +++ + 1 file changed, 3 insertions(+) + +commit 9cdc043c16d319268677a9098c83dc572d279c99 +Author: Behdad Esfahbod +Date: Mon Jul 31 18:53:29 2023 -0600 + + [Cursive] Only sanitize what we use + + src/OT/Layout/GPOS/CursivePosFormat1.hh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 25e9defa516d63b12a659282a13dc9e1fe522cc8 +Author: Behdad Esfahbod +Date: Mon Jul 31 17:12:07 2023 -0600 + + [sanitize] Inline check_struct + + Though seems like the compiler was always inlining it anyway. + + src/hb-sanitize.hh | 3 +++ + 1 file changed, 3 insertions(+) + +commit 44026aa8a992b7105a615f1fbaaf0e342b634efa +Author: Behdad Esfahbod +Date: Mon Jul 31 16:47:06 2023 -0600 + + [Cursive] Minor, adjust unsafe-to-concat if prev didn't sanitize + + src/OT/Layout/GPOS/CursivePosFormat1.hh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit b382e616cc807fe16da0fe7baca6dc2335fab987 +Author: Behdad Esfahbod +Date: Mon Jul 31 16:29:28 2023 -0600 + + [GPOS] Sanitize Cursive positioning anchors lazily + + Speeds up Duployan-Regular.otf load time by 30%. + Doesn't seem to slow down shaping in a measurable way. + + src/OT/Layout/GPOS/CursivePosFormat1.hh | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + commit fcb9e5915f5d20b20576612efd4ee15d9da04c8a Author: Khaled Hosny Date: Tue Aug 1 00:57:06 2023 +0300 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS index ef21e1e1702..0a7b94b58a9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/NEWS +++ b/Build/source/libs/harfbuzz/harfbuzz-src/NEWS @@ -1,3 +1,11 @@ +Overview of changes leading to 8.1.1 +Wednesday, August 2, 2023 +==================================== +- Fix shaping of contextual rules at the end of string, introduced in 8.1.0 +- Fix stack-overflow in repacker with malicious fonts. +- 30% speed up loading Noto Duployan font. + + Overview of changes leading to 8.1.0 Tuesday, August 1, 2023 ==================================== diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac index d6361b0db93..94257081be1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac +++ b/Build/source/libs/harfbuzz/harfbuzz-src/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.64]) AC_INIT([HarfBuzz], - [8.1.0], + [8.1.1], [https://github.com/harfbuzz/harfbuzz/issues/new], [harfbuzz], [http://harfbuzz.org/]) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/meson.build b/Build/source/libs/harfbuzz/harfbuzz-src/meson.build index 2e459ce9605..85e453d7274 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/meson.build +++ b/Build/source/libs/harfbuzz/harfbuzz-src/meson.build @@ -1,6 +1,6 @@ project('harfbuzz', 'c', 'cpp', meson_version: '>= 0.55.0', - version: '8.1.0', + version: '8.1.1', default_options: [ 'cpp_eh=none', # Just to support msvc, we are passing -fno-exceptions also anyway 'cpp_rtti=false', # Just to support msvc, we are passing -fno-rtti also anyway diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/CursivePosFormat1.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/CursivePosFormat1.hh index 675bb83bcf1..54852aae75a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/CursivePosFormat1.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/CursivePosFormat1.hh @@ -91,7 +91,13 @@ struct CursivePosFormat1 bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (coverage.sanitize (c, this) && entryExitRecord.sanitize (c, this)); + if (unlikely (!coverage.sanitize (c, this))) + return_trace (false); + + if (c->lazy_some_gpos) + return_trace (entryExitRecord.sanitize_shallow (c)); + else + return_trace (entryExitRecord.sanitize (c, this)); } bool intersects (const hb_set_t *glyphs) const @@ -119,10 +125,11 @@ struct CursivePosFormat1 hb_buffer_t *buffer = c->buffer; const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage (buffer->cur().codepoint)]; - if (!this_record.entryAnchor) return_trace (false); + if (!this_record.entryAnchor || + unlikely (!this_record.entryAnchor.sanitize (&c->sanitizer, this))) return_trace (false); hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; - skippy_iter.reset_fast (buffer->idx, 1); + skippy_iter.reset_fast (buffer->idx); unsigned unsafe_from; if (unlikely (!skippy_iter.prev (&unsafe_from))) { @@ -131,7 +138,8 @@ struct CursivePosFormat1 } const EntryExitRecord &prev_record = entryExitRecord[(this+coverage).get_coverage (buffer->info[skippy_iter.idx].codepoint)]; - if (!prev_record.exitAnchor) + if (!prev_record.exitAnchor || + unlikely (!prev_record.exitAnchor.sanitize (&c->sanitizer, this))) { buffer->unsafe_to_concat_from_outbuffer (skippy_iter.idx, buffer->idx + 1); return_trace (false); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/MarkMarkPosFormat1.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/MarkMarkPosFormat1.hh index 9dae5ce5dac..72535f4c983 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/MarkMarkPosFormat1.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/MarkMarkPosFormat1.hh @@ -100,7 +100,7 @@ struct MarkMarkPosFormat1_2 /* now we search backwards for a suitable mark glyph until a non-mark glyph */ hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; - skippy_iter.reset_fast (buffer->idx, 1); + skippy_iter.reset_fast (buffer->idx); skippy_iter.set_lookup_props (c->lookup_props & ~(uint32_t)LookupFlag::IgnoreFlags); unsigned unsafe_from; if (unlikely (!skippy_iter.prev (&unsafe_from))) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat1.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat1.hh index 714b4bec724..e4a2006fb98 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat1.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat1.hh @@ -110,7 +110,7 @@ struct PairPosFormat1_3 if (likely (index == NOT_COVERED)) return_trace (false); hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; - skippy_iter.reset_fast (buffer->idx, 1); + skippy_iter.reset_fast (buffer->idx); unsigned unsafe_to; if (unlikely (!skippy_iter.next (&unsafe_to))) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat2.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat2.hh index 05e6c0fa548..1bde9e755e9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat2.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GPOS/PairPosFormat2.hh @@ -131,7 +131,7 @@ struct PairPosFormat2_4 if (likely (index == NOT_COVERED)) return_trace (false); hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; - skippy_iter.reset_fast (buffer->idx, 1); + skippy_iter.reset_fast (buffer->idx); unsigned unsafe_to; if (unlikely (!skippy_iter.next (&unsafe_to))) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GSUB/LigatureSet.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GSUB/LigatureSet.hh index cacb2b362d3..08665438c4a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GSUB/LigatureSet.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/OT/Layout/GSUB/LigatureSet.hh @@ -97,7 +97,7 @@ struct LigatureSet * This is replicated in ChainRuleSet and RuleSet. */ hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; - skippy_iter.reset (c->buffer->idx, 1); + skippy_iter.reset (c->buffer->idx); skippy_iter.set_match_func (match_always, nullptr); skippy_iter.set_glyph_data ((HBUINT16 *) nullptr); unsigned unsafe_to; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/graph/graph.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/graph/graph.hh index 2b89b99962e..06809581904 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/graph/graph.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/graph/graph.hh @@ -187,6 +187,11 @@ struct graph_t unsigned incoming_edges () const { + if (HB_DEBUG_SUBSET_REPACK) + { + assert (incoming_edges_ == (single_parent != (unsigned) -1) + + (parents.values_ref () | hb_reduce (hb_add, 0))); + } return incoming_edges_; } @@ -199,6 +204,7 @@ struct graph_t void add_parent (unsigned parent_index) { + assert (parent_index != (unsigned) -1); if (incoming_edges_ == 0) { single_parent = parent_index; @@ -207,12 +213,19 @@ struct graph_t } else if (single_parent != (unsigned) -1) { + assert (incoming_edges_ == 1); if (!parents.set (single_parent, 1)) return; single_parent = (unsigned) -1; } - if (parents.set (parent_index, parents[parent_index] + 1)) + unsigned *v; + if (parents.has (parent_index, &v)) + { + (*v)++; + incoming_edges_++; + } + else if (parents.set (parent_index, 1)) incoming_edges_++; } @@ -230,7 +243,7 @@ struct graph_t { incoming_edges_--; if (*v > 1) - *v -= 1; + (*v)--; else parents.del (parent_index); @@ -259,20 +272,29 @@ struct graph_t } } - void remap_parents (const hb_vector_t& id_map) + bool remap_parents (const hb_vector_t& id_map) { if (single_parent != (unsigned) -1) { + assert (single_parent < id_map.length); single_parent = id_map[single_parent]; - return; + return true; } hb_hashmap_t new_parents; new_parents.alloc (parents.get_population ()); for (auto _ : parents) - new_parents.set (id_map[_.first], _.second); + { + assert (_.first < id_map.length); + assert (!new_parents.has (id_map[_.first])); + new_parents.set (id_map[_.first], _.second); + } + + if (new_parents.in_error ()) + return false; parents = std::move (new_parents); + return true; } void remap_parent (unsigned old_index, unsigned new_index) @@ -284,10 +306,12 @@ struct graph_t return; } - if (parents.has (old_index)) + const unsigned *pv; + if (parents.has (old_index, &pv)) { - remove_parent (old_index); - add_parent (new_index); + unsigned v = *pv; + parents.set (new_index, v); + parents.del (old_index); } } @@ -568,7 +592,7 @@ struct graph_t check_success (!queue.in_error ()); check_success (!sorted_graph.in_error ()); - remap_all_obj_indices (id_map, &sorted_graph); + check_success (remap_all_obj_indices (id_map, &sorted_graph)); vertices_ = std::move (sorted_graph); if (!check_success (new_id == -1)) @@ -763,12 +787,15 @@ struct graph_t subgraph.set (root_idx, wide_parents (root_idx, parents)); find_subgraph (root_idx, subgraph); } + if (subgraph.in_error ()) + return false; unsigned original_root_idx = root_idx (); hb_map_t index_map; bool made_changes = false; for (auto entry : subgraph.iter ()) { + assert (entry.first < vertices_.length); const auto& node = vertices_[entry.first]; unsigned subgraph_incoming_edges = entry.second; @@ -1192,6 +1219,8 @@ struct graph_t unsigned space_for (unsigned index, unsigned* root = nullptr) const { + loop: + assert (index < vertices_.length); const auto& node = vertices_[index]; if (node.space) { @@ -1207,7 +1236,8 @@ struct graph_t return 0; } - return space_for (*node.parents_iter (), root); + index = *node.parents_iter (); + goto loop; } void err_other_error () { this->successful = false; } @@ -1267,9 +1297,7 @@ struct graph_t for (unsigned p = 0; p < count; p++) { for (auto& l : vertices_.arrayZ[p].obj.all_links ()) - { vertices_[l.objidx].add_parent (p); - } } for (unsigned i = 0; i < count; i++) @@ -1404,18 +1432,20 @@ struct graph_t /* * Updates all objidx's in all links using the provided mapping. */ - void remap_all_obj_indices (const hb_vector_t& id_map, + bool remap_all_obj_indices (const hb_vector_t& id_map, hb_vector_t* sorted_graph) const { unsigned count = sorted_graph->length; for (unsigned i = 0; i < count; i++) { - (*sorted_graph)[i].remap_parents (id_map); + if (!(*sorted_graph)[i].remap_parents (id_map)) + return false; for (auto& link : sorted_graph->arrayZ[i].obj.all_links_writer ()) { link.objidx = id_map[link.objidx]; } } + return true; } /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-kern.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-kern.hh index 9ac744c9ddc..0462a0ea8ee 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-kern.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-kern.hh @@ -70,7 +70,7 @@ struct hb_kern_machine_t continue; } - skippy_iter.reset (idx, 1); + skippy_iter.reset (idx); unsigned unsafe_to; if (!skippy_iter.next (&unsafe_to)) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh index 136e088ab01..662ec9d3e8c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh @@ -518,11 +518,9 @@ struct hb_ot_apply_context_t : #ifndef HB_OPTIMIZE_SIZE HB_ALWAYS_INLINE #endif - void reset (unsigned int start_index_, - unsigned int num_items_) + void reset (unsigned int start_index_) { idx = start_index_; - num_items = num_items_; end = c->buffer->len; matcher.set_syllable (start_index_ == c->buffer->idx ? c->buffer->cur().syllable () : 0); } @@ -530,17 +528,14 @@ struct hb_ot_apply_context_t : #ifndef HB_OPTIMIZE_SIZE HB_ALWAYS_INLINE #endif - void reset_fast (unsigned int start_index_, - unsigned int num_items_) + void reset_fast (unsigned int start_index_) { // Doesn't set end or syllable. Used by GPOS which doesn't care / change. idx = start_index_; - num_items = num_items_; } void reject () { - num_items++; backup_glyph_data (); } @@ -583,12 +578,7 @@ struct hb_ot_apply_context_t : #endif bool next (unsigned *unsafe_to = nullptr) { - assert (num_items > 0); - /* The alternate condition below is faster at string boundaries, - * but produces subpar "unsafe-to-concat" values. */ - signed stop = (signed) end - (signed) num_items; - if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT) - stop = (signed) end - 1; + const signed stop = (signed) end - 1; while ((signed) idx < stop) { idx++; @@ -596,7 +586,6 @@ struct hb_ot_apply_context_t : { case MATCH: { - num_items--; advance_glyph_data (); return true; } @@ -619,12 +608,7 @@ struct hb_ot_apply_context_t : #endif bool prev (unsigned *unsafe_from = nullptr) { - assert (num_items > 0); - /* The alternate condition below is faster at string boundaries, - * but produces subpar "unsafe-to-concat" values. */ - unsigned stop = num_items - 1; - if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT) - stop = 1 - 1; + const unsigned stop = 0; while (idx > stop) { idx--; @@ -632,7 +616,6 @@ struct hb_ot_apply_context_t : { case MATCH: { - num_items--; advance_glyph_data (); return true; } @@ -691,7 +674,6 @@ struct hb_ot_apply_context_t : const HBUINT24 *match_glyph_data24; #endif - unsigned int num_items; unsigned int end; }; @@ -1283,7 +1265,7 @@ static bool match_input (hb_ot_apply_context_t *c, hb_buffer_t *buffer = c->buffer; hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; - skippy_iter.reset (buffer->idx, count - 1); + skippy_iter.reset (buffer->idx); skippy_iter.set_match_func (match_func, match_data); skippy_iter.set_glyph_data (input); @@ -1523,7 +1505,7 @@ static bool match_backtrack (hb_ot_apply_context_t *c, TRACE_APPLY (nullptr); hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context; - skippy_iter.reset (c->buffer->backtrack_len (), count); + skippy_iter.reset (c->buffer->backtrack_len ()); skippy_iter.set_match_func (match_func, match_data); skippy_iter.set_glyph_data (backtrack); @@ -1556,7 +1538,7 @@ static bool match_lookahead (hb_ot_apply_context_t *c, TRACE_APPLY (nullptr); hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context; - skippy_iter.reset (start_index - 1, count); + skippy_iter.reset (start_index - 1); skippy_iter.set_match_func (match_func, match_data); skippy_iter.set_glyph_data (lookahead); @@ -2175,7 +2157,7 @@ struct RuleSet * Replicated from LigatureSet::apply(). */ hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; - skippy_iter.reset (c->buffer->idx, 2); + skippy_iter.reset (c->buffer->idx); skippy_iter.set_match_func (match_always, nullptr); skippy_iter.set_glyph_data ((HBUINT16 *) nullptr); unsigned unsafe_to = (unsigned) -1, unsafe_to1 = 0, unsafe_to2 = 0; @@ -3346,7 +3328,7 @@ struct ChainRuleSet * Replicated from LigatureSet::apply(). */ hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; - skippy_iter.reset (c->buffer->idx, 2); + skippy_iter.reset (c->buffer->idx); skippy_iter.set_match_func (match_always, nullptr); skippy_iter.set_glyph_data ((HBUINT16 *) nullptr); unsigned unsafe_to = (unsigned) -1, unsafe_to1 = 0, unsafe_to2 = 0; @@ -4353,6 +4335,9 @@ struct hb_ot_layout_lookup_accelerator_t bool may_have (hb_codepoint_t g) const { return digest.may_have (g); } +#ifndef HB_OPTIMIZE_SIZE + HB_ALWAYS_INLINE +#endif bool apply (hb_ot_apply_context_t *c, unsigned subtables_count, bool use_cache) const { #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-sanitize.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-sanitize.hh index 8d9ecce8d78..efb5adde5f3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-sanitize.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-sanitize.hh @@ -382,6 +382,9 @@ struct hb_sanitize_context_t : } template +#ifndef HB_OPTIMIZE_SIZE + HB_ALWAYS_INLINE +#endif bool check_struct (const Type *obj) const { if (sizeof (uintptr_t) == sizeof (uint32_t)) diff --git a/Build/source/libs/harfbuzz/version.ac b/Build/source/libs/harfbuzz/version.ac index f19f3ceaba3..fd38c3ca76a 100644 --- a/Build/source/libs/harfbuzz/version.ac +++ b/Build/source/libs/harfbuzz/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current harfbuzz version -m4_define([harfbuzz_version], [8.1.0]) +m4_define([harfbuzz_version], [8.1.1]) -- cgit v1.2.3