Commit Graph
21333 Commits
Author SHA1 Message Date
dependabot[bot] 22ea52f42f Bump github/codeql-action from 4.35.4 to 4.35.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.4 to 4.35.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/68bde559dea0fdcac2102bfdf6230c5f70eb485e...9e0d7b8d25671d64c341c19c0152d693099fb5ba)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-19 09:09:27 +03:00
dependabot[bot] cbd63f557e Bump fonttools from 4.62.1 to 4.63.0 in /.ci
Bumps [fonttools](https://github.com/fonttools/fonttools) from 4.62.1 to 4.63.0.
- [Release notes](https://github.com/fonttools/fonttools/releases)
- [Changelog](https://github.com/fonttools/fonttools/blob/main/NEWS.rst)
- [Commits](https://github.com/fonttools/fonttools/compare/4.62.1...4.63.0)

---
updated-dependencies:
- dependency-name: fonttools
  dependency-version: 4.63.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-19 09:09:03 +03:00
Behdad Esfahbod f3c6b3ab92 [algs] Saturating arithmetic for get_size() on 32-bit (#5988)
On 32-bit platforms size_t is unsigned int, so the typical
get_size() computation `min_size + count * static_size`
silently wraps when the product exceeds UINT_MAX.  The
truncated value then flows into sanitize / serialize as a
small but plausible size, defeating bounds checks.

Add three helpers in hb-algs.hh:

  hb_unsigned_mul_saturate (a, b, ...)
  hb_unsigned_add_saturate (a, b, ...)
  hb_unsigned_mul_add_saturate (a, b, c)   /* a*b + c */

They saturate to SIZE_MAX on overflow.  Variadic overloads
left-fold so 3+ arguments work.  On 64-bit (size_t wider than
unsigned int), all three reduce to plain a*b / a+b — the
inputs to size computations are at most unsigned int so the
result fits in size_t without overflow.

Convert every get_size() that does arithmetic over variable
inputs:

  hb-open-type.hh        UnsizedArrayOf, ArrayOf,
                         HeadlessArrayOf, ArrayOfM1,
                         sorted-array-with-header, CFFIndex
  hb-ot-layout-common.hh CmapSubtableFormat-style,
                         VarRegionList, VarData, MultiVarData,
                         DeltaSetIndexMapFormat01
  hb-ot-hdmx-table.hh    DeviceRecord, hdmx
  hb-ot-cff-common.hh    Charset0, Charset wrapper
  hb-ot-cff1-table.hh    Encoding, Charset wrapper
                         (also widened unsigned accumulator
                         to size_t)
  hb-ot-os2-table.hh     OS/2 (widened accumulator to size_t)
  hb-ot-var-common.hh    TupleVariationHeader,
                         TupleVariationData accumulator
  hb-ot-var-hvar-table.hh DeltaSetIndexMap
  hb-vector.hh           hb_vector_t::get_size

When saturation kicks in, check_range() and extend_size()
naturally reject the resulting value (SIZE_MAX truncated to
unsigned is UINT_MAX, far past any real blob; extend_size
already rejects sizes >= INT_MAX).

Assisted-by: Claude <noreply@anthropic.com>
2026-05-18 15:11:34 -06:00
Behdad Esfahbod fd0360d985 [gpu] Silence float-to-double promotion warnings in Metal demo
MTLClearColorMake takes doubles; cast bg[] floats explicitly to
avoid -Wdouble-promotion warnings.

Assisted-by: Claude <noreply@anthropic.com>
2026-05-18 15:30:45 +01:00
Dominik Röttsches 4321818220 Cross-platform clippy-friendly casts in FFI
Bindgen generates a std::os::raw::c_char as return type for
functions like hb_blob_get_data. Depending on platform/arch, this
can be an i8 or u8. In the Rust side code, receiving
the data, these are interpreted as u8. Perform the pointer
casts in a way that compiles without clippy warnings about
unnecessary casts when the c_char type was already u8.
2026-05-18 17:02:39 +03:00
Khaled Hosny 8d24ed6cd6 [arabic-pua] Fix mapping for isolated lam alef maksura ligature (#5985)
Correct the ArabicPUATraditional.txt entry for 0xF295 which should be
isolated not final form. Also enable 0xFC43 ligature so the ligature is
actually used.

Fixes https://github.com/harfbuzz/harfbuzz/issues/5984
2026-05-17 15:24:40 -06:00
Behdad Esfahbod c31d554e4a Some more 32bit overflow hardening
Should fix https://issues.chromium.org/issues/513143921
plus speculative fixes.
2026-05-17 14:24:10 +01:00
Behdad Esfahbod 56b9727aa7 [check-symbols] Err on weakly-public symbols as well
https://github.com/harfbuzz/harfbuzz/issues/5895#issuecomment-4461712887
2026-05-16 13:17:31 +01:00
Behdad Esfahbod cf9c3eb36e [vector] Fix heap buffer overflow in append_base64 / append_len
When the sum old_len + out_len (or old_len + l) exceeded INT_MAX,
the (int) cast turned it negative.  resize_full() treated negative
size as zero, alloc(0) succeeded, and the subsequent write loop
overflowed the buffer.

Fix both layers:

- resize_full(): reject negative size_ (return false) instead of
  silently treating it as zero.  This is defense-in-depth for every
  caller that casts unsigned to int.

- append_len() and append_base64(): use hb_unsigned_add_overflows()
  to detect unsigned wraparound before the cast.  This catches the
  case where old_len + new_bytes > UINT_MAX wraps to a small
  positive value that would pass the negative check.

Assisted-by: Claude <noreply@anthropic.com>
2026-05-16 13:06:40 +01:00
Dominik Röttsches 0cf18e7b64 Fix warnings in embedder build with newer rustc (#5983)
Wrap no_mangle in unsafe() to address compiler warnings
with newer rust compilers/editions.
2026-05-13 07:52:32 -06:00
Dominik Röttsches 3986312ea2 Make Rust global_allocator mapping optional (#5982)
In embedding projects, the global_allocator might already have been
overriden. There is no known way to keep the allocator library-local,
and allocator-bound containers are not a stable Rust feature yet.

Add an option to disable the allocator mapping to hb_malloc and friends,
so that an embedder can keep their own allocator.
2026-05-13 07:51:52 -06:00
dependabot[bot] af541c2279 Bump github/codeql-action from 4.35.3 to 4.35.4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.3 to 4.35.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/e46ed2cbd01164d986452f91f178727624ae40d7...68bde559dea0fdcac2102bfdf6230c5f70eb485e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-11 19:07:13 +03:00
parasol-aserandjeffhuang da577bc545 test: strengthen buffer and map API coverage (#5979)
Add focused API tests for hb_buffer_create_similar() and buffer
configuration persistence across clear/reset. Also exercise public hb_map
copy, equality, hash, update, iteration, keys, and values paths with
order-independent assertions.

Validation:
meson test -C build-tgl-precheck --print-errorlogs --suite api test-buffer
meson test -C build-tgl-precheck --print-errorlogs --suite api test-map
meson test -C build-tgl-precheck --print-errorlogs --suite api test-buffer test-map

Assisted-by: OpenAI Codex <codex@openai.com>

Co-authored-by: jeffhuang <jeff@docker.xydrsucermoubd24xgo33yhsgd.bx.internal.cloudapp.net>
2026-05-06 17:27:10 -06:00
Metaspook 5062828615 Add Flutter to list of users in README.md (#5978) 2026-05-05 22:34:40 -06:00
Behdad Esfahbod de77426147 [gpu-paint] Limit clip rasterization ops
Fixes timeout https://oss-fuzz.com/testcase-detail/4582727033880576
2026-05-05 10:10:08 -06:00
Behdad Esfahbod 5ee942feb6 [gpu_demo] Fix web demo build 2026-05-04 09:58:05 -06:00
Behdad Esfahbod 8aaa51013b [gpu_demo] Silence compiler warnings 2026-05-04 09:50:11 -06:00
Behdad Esfahbod a45382c12c [gpu_demo] Fix build in Windows
Don't use std::min/std::max.

Fixes https://github.com/harfbuzz/harfbuzz/issues/5971
2026-05-04 09:50:11 -06:00
dependabot[bot] 9a3a13c2c1 Bump github/codeql-action from 4.35.2 to 4.35.3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.2 to 4.35.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/95e58e9a2cdfd71adc6e0353d5c52f41a045d225...e46ed2cbd01164d986452f91f178727624ae40d7)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 18:42:04 +03:00
Behdad Esfahbod f90bc293e0 Merge pull request #5973 from harfbuzz/no-std-sort
Revert back from using std::sort
2026-05-02 12:37:43 -06:00
Behdad EsfahbodandClaude Opus 4.7 09795f3215 [post] Fix flipped glyph-name sort comparator on macOS
The std::sort revert (d3a1de25e3) inadvertently inverted the
post-table glyph-name sort.  hb_array_t::cmp has reversed
argument order — x.cmp(y) returns the sign of (y - x), not
(x - y) — so dropping the `> 0` from the bool-returning
lambda turned ascending into descending order.

On Linux the quicksort happened to leave the array in an
order that bsearch could still find names; on macOS, where
the system sort behaves differently, this exposed the bug.

Pass (b, a) to find_glyph_name(...).cmp(...) to recover the
intended ascending order.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 12:08:21 -06:00
Behdad Esfahbod 58deffd897 [qsort] Lower threshold from 32 to 24 2026-05-02 11:59:22 -06:00
Behdad EsfahbodandClaude Opus 4.7 e064b9f79d [algs] Defer insertion sort to single final pass; bump threshold to 32
Restructure hb_qsort_inline so the recursive partitioning loop
stops at subranges of size <= threshold without sorting them,
and the entry point runs one insertion sort over the entire
array at the end.  After the partitioning loop, every element
is within the threshold of its sorted position, so the final
pass is O(n * threshold) — cache-friendlier than a per-leaf
insertion sort, which is what libstdc++'s std::sort does too.

Also bump the threshold from 16 to 32, which the deferred
scheme prefers (per-leaf insertion sort prefers 16; the
deferred form amortizes a larger threshold better).

Bench (NotoSansCJK GPU encode, smaller is better):
  std::sort baseline:                                570 ms
  per-leaf insertion sort, threshold 16 (parent):    613 ms
  per-leaf insertion sort, threshold 32:             623 ms
  deferred insertion sort, threshold 16:             620 ms
  deferred insertion sort, threshold 32 (this):      610 ms
  deferred insertion sort, threshold 64:             610 ms
  deferred insertion sort, threshold 96:             620 ms

Tested: 240/240 tests pass; nm -D libharfbuzz.so shows zero
remaining _ZSt sort weak symbols.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:56:14 -06:00
Behdad EsfahbodandClaude Opus 4.7 691033793a [algs] Replace byte-based sort with typed two-way quicksort
Rewrite the internal qsort used by hb_array_t::qsort(Compar) as a
typed template hb_qsort_inline<T, Compar>:

  * Operates on T* directly, so swap is T-typed (one move per
    half-element instead of a per-byte loop).  hb_swap is used,
    which uses ADL std::swap.
  * Two-way Hoare partition instead of three-way Bentley-McIlroy.
    The previous three-way scheme paid extra branch overhead in
    the inner partition loop without payoff on the typical
    HarfBuzz workload (sorting unique curve indices, glyph IDs,
    feature tags, etc).
  * Median-of-three pivot, parked at last-1.
  * Tail-call elimination on the larger partition; recurse only
    on the smaller.  Bounds stack depth at O(log n).
  * Insertion-sort threshold bumped from 10 to 16, matching
    libstdc++'s std::sort.

The byte-based sort_r_simple (and helpers SORT_R_SWAP, sort_r_swap,
sort_r_cmpswap, sort_r_swap_blocks) is removed; nothing else used
it.  hb_qsort still forwards to system qsort.

Bench (NotoSansCJK GPU encode, smaller is better):
  std::sort baseline:                 570 ms
  byte-based sort_r_simple (step 1):  650 ms (+14%)
  three-way typed quicksort:          640 ms
  two-way typed quicksort (this):     613 ms (+7.5% vs baseline)

ABI: zero std:: weak symbols leak from libharfbuzz.so, same as
step 1.

Tested: 240/240 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:45:28 -06:00
Behdad EsfahbodandClaude Opus 4.7 d3a1de25e3 [array] Replace std::sort with internal sort_r_simple
std::sort instantiates several internal STL helpers
(__introsort_loop, __insertion_sort, __adjust_heap, __heap_select,
__unguarded_linear_insert) as weak symbols in the std:: namespace.
These leaked into libharfbuzz.so for every distinct (T, Compar)
pair, polluting the public ABI surface.

Route hb_array_t::qsort(Compar) through our existing templated
sort_r_simple instead.  The comparator is still inlined into the
sort body (sort_r_simple has been comparator-templated since
05762b2fac).

Drop the bool-returning comparator overload in favor of a single
int-sign convention; convert the call sites added during the
std::sort migration back to int-sign comparators.

Step 1 of two: this restores ABI hygiene at the cost of typed-
element swap (sort_r_simple swaps byte-by-byte).  A follow-up
will introduce a typed sort to recover that perf.

Tested: 240/240 tests pass; nm -D libharfbuzz.so shows zero
remaining _ZSt sort weak symbols.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:32:17 -06:00
Qunxin Liu 209a7237b9 [repacker] fuzzer fix: duplicate shared liga_sets before splitting (#5972)
fix for: https://oss-fuzz.com/testcase-detail/5291844211900416
2026-05-01 14:50:05 -06:00
Sergei Lopatin ef1b37502a [ft] Bump minimum freetype version to 2.8.0 (20.0.14)
e31ea830c8 added use of FT_Set_Default_Properties,
which was introduced in FreeType 2.8.

Reference: https://freetype.org/freetype2/docs/reference/ft2-module_management.html#ft_set_default_properties
2026-04-30 19:29:02 +03:00
Andrew Tribick ab6aa4f449 Allow line-ending changes in gen-gpu-shader-artifacts.py (#5968) 2026-04-28 13:59:28 -06:00
Behdad Esfahbod e6741e2205 [harfbuzz-world] Fix macros
Fixes https://github.com/harfbuzz/uharfbuzz/pull/289#discussion_r3149665614
2026-04-28 15:52:29 +03:00
dependabot[bot] 79784ef4db Bump meson from 1.11.0 to 1.11.1 in /.ci
Bumps [meson](https://github.com/mesonbuild/meson) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.11.0...1.11.1)

---
updated-dependencies:
- dependency-name: meson
  dependency-version: 1.11.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 19:10:07 +03:00
dependabot[bot] 00cbd9850a Bump hendrikmuhs/ccache-action from 1.2.22 to 1.2.23
Bumps [hendrikmuhs/ccache-action](https://github.com/hendrikmuhs/ccache-action) from 1.2.22 to 1.2.23.
- [Release notes](https://github.com/hendrikmuhs/ccache-action/releases)
- [Commits](https://github.com/hendrikmuhs/ccache-action/compare/33522472633dbd32578e909b315f5ee43ba878ce...d62db5f07c26379fc4b4e0916f098a92573c3b03)

---
updated-dependencies:
- dependency-name: hendrikmuhs/ccache-action
  dependency-version: 1.2.23
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 19:09:33 +03:00
Behdad Esfahbod 73db8cc1a5 [gpu] Fix HLSL paint fragment compile error
At least on wine this was needed.
2026-04-23 03:18:15 -06:00
Behdad Esfahbod f7511709ee [gpu] Remove outdated comment 2026-04-23 02:40:49 -06:00
Behdad Esfahbod 1b9c0c9dd6 [subset/gvar] Protect against overflow on 32bit systems 2026-04-22 13:17:59 -06:00
璀境石 74396731ad [cmake] Fix missing hb-static.cc in gpu target (#5960) 2026-04-21 21:33:16 -06:00
Behdad Esfahbod 0091ae360e [hb-config.hh] Tweak HB_TINY / HB_NO_DRAW / HB_NO_CFF relationship
Fixes https://github.com/harfbuzz/harfbuzz/issues/5955
2026-04-22 00:30:35 +02:00
璀境石 14d1d035cc [cmake] Add a .gitignore file to build directory (inspired by Meson) (#5957) 2026-04-21 08:56:46 -06:00
dependabot[bot] d25e930364 Bump meson from 1.10.2 to 1.11.0 in /.ci
Bumps [meson](https://github.com/mesonbuild/meson) from 1.10.2 to 1.11.0.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.10.2...1.11.0)

---
updated-dependencies:
- dependency-name: meson
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-21 02:09:46 +02:00
dependabot[bot] e8fbf406c4 Bump github/codeql-action from 4.35.1 to 4.35.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.1 to 4.35.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/c10b8064de6f491fea524254123dbe5e09572f13...95e58e9a2cdfd71adc6e0353d5c52f41a045d225)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-20 15:27:05 +02:00
Khaled Hosny b0ffab42d4 14.2.0 14.2.0 2026-04-20 05:10:48 +02:00
Behdad Esfahbod 6988bda8ac [gpu] Move blob-recycling from gpu to blob.hh 2026-04-20 01:29:49 +02:00
Behdad Esfahbod 98202cd72f [gpu-paint] Cosmetic 2026-04-20 01:29:49 +02:00
Behdad Esfahbod 90ba85bebc [gpu-draw] Cosmetic 2026-04-20 01:29:49 +02:00
Behdad Esfahbod d26e90c6c8 [gpu] Add HB_GPU_SHADER_LANG_INVALID 2026-04-20 01:29:49 +02:00
Behdad Esfahbod 521d7b2e99 [vector] Approximate a couple of Porter-Duff modes
The rest need structural change.
2026-04-20 01:29:49 +02:00
Behdad Esfahbod 1ae32fb6a7 [vector-pdf] Clean up color-stop passing around 2026-04-20 01:29:49 +02:00
Behdad Esfahbod f433a59dac [vector-svg] Cosmetic 2026-04-20 01:29:49 +02:00
Behdad Esfahbod 0b718a9f09 [raster/vector/gpu] Streamline color-stop fetching 2026-04-20 01:29:49 +02:00
Behdad Esfahbod 74514fc7d6 [vector-svg] Streamline set_svg_prefix() 2026-04-20 01:29:49 +02:00
Behdad Esfahbod 6ef43b340d [hb-vector] Touchups 2026-04-20 01:29:49 +02:00