Commit Graph
22076 Commits
Author SHA1 Message Date
Behdad Esfahbod bd35da613d [test] Remove disabled advance checks from the obsolete proposal
Delete the remaining dead assertions for the old beyond-64K hmtx
extension, along with their stale adaptation comment. The current
specification uses separate capital-letter tables.

Leave the active legacy-table assertions and fixture unchanged.

Testing: full Meson suite: 281 passed, one skipped.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 11:22:24 -06:00
Behdad Esfahbod 7c97afd21b [ot-var] Reject oversized implicit advance variation indices
An absent HVAR/VVAR advance map implies outer index zero and inner index
equal to the glyph ID. A glyph ID above 65535 cannot address that table;
do not reinterpret it as a packed index selecting another outer table.
Explicit mappings remain unchanged.

Add a regression using an existing two-subtable HVAR fixture. Verify the
implicit boundary and explicit high-glyph mapping at nine locations.
This hardens malformed fonts whose implicit item count cannot cover their
glyph set; it does not change valid explicit mappings.

Testing: full Meson suite: 281 passed, one skipped. The new test fails
before the guard and passes afterwards.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 11:21:17 -06:00
Behdad Esfahbod cafaa1d886 [ot-font] Keep vertical origins available without variations
The glyf vertical-origin path also handles static VARC-backed fonts, but
its point aggregator and origin helper were hidden by HB_NO_VAR. The
caller also accessed the absent gvar accelerator in that configuration.

Keep the static-capable helpers available and guard only variation cache
acquisition and release. Do not change glyph placement or origin math.

Testing: C++11 syntax checks of harfbuzz-world.cc with and without
HB_NO_VAR; full Meson suite: 281 passed, one skipped.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 11:20:28 -06:00
Behdad Esfahbod c034548995 [subset] Preserve the unrounded sign of constant layout conditions
Partial instancing used the rounded positioning delta to fold format-2
conditions. A positive fraction could round to zero and lose a lookup.
Evaluate the original GDEF store at the pinned/default coordinates when
the projected variation index becomes NO_VARIATION_INDEX instead.

Keep integer rounding for conditions with remaining variation and for
ordinary positioning values. The new helper is internal-only.

Extend the legacy condition grid and add an additive lookup regression
using existing fonts. The full Meson suite passes (281 tests, one skip),
including shape and subset suites. All 32 cross-library full/partial
GSUB/GPOS instancing diagnostics preserve the original shaping.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 11:09:38 -06:00
Behdad Esfahbod 2153daba2f [subset] Extract retained-condition pointer before the ternary
The universal first-match fix mixed hb::shared_ptr and nullptr in a
conditional expression. GCC 13 rejects that expression, breaking the
GCC-based CI jobs even though Clang and GCC 15 accept it.

Use shared_ptr::get() so both operands have compatible pointer types.
This preserves the existing ownership and null handling.

Reproduced the rejected expression with GCC 13 and verified the fixed
expression and C++11 amalgamation syntax check. The full Meson suite
passes: 281 passed, 1 skipped. Local GCC C++11/C++20 and Clang C++11
checks also pass, as do all six reduced-feature CI profiles.

Assisted-by: OpenAI Codex <noreply@openai.com>
2026-10-02 06:51:11 -06:00
Behdad Esfahbod e5ce527941 [cff2] Support VARC glyphs beyond the CharStrings INDEX
OFF permits CFF2 CharStrings to omit a tail of glyphs provided by
VARC. Accept this count mismatch only when VARC is present, and
validate FDSelect against both the CharStrings and font glyph counts.
Reject malformed explicit FDSelect tables instead of using FD zero.

Add draw and count-mismatch regressions, plus FDSelect format 3 and 4
sentinel checks. The full Meson suite passes: 281 passed, 1 skipped.
C++11 syntax checks pass with extended and reduced features.

Assisted-by: OpenAI Codex <noreply@openai.com>
2026-10-02 06:43:14 -06:00
Behdad Esfahbod 955770eaa8 [subset] Preserve universal first-match records after axis pinning
A satisfied condition set becomes universal when all its conditions are
dropped, even if no remaining condition requested retention. Mark that
record universal and retain it while other axes remain, preventing
later records and an obsolete default catch-all from changing behavior.

Serialize reduced unconditional records with a null ConditionSet.
Regress GSUB and GPOS together, with an earlier conditional record and
LookupVariationRecord ADD_DEFAULT_LOOKUPS interaction. Regenerate the
existing instance goldens for the unconditional-record representation.

Testing: full Meson suite, 281 passed and one expected skip.

Assisted-by: OpenAI Codex <noreply@openai.com>
2026-10-02 06:20:51 -06:00
Behdad Esfahbod 52acd12dbb [build] Remove accidentally tracked Python bytecode
The merge imported a machine-generated CPython 3.12 check_helpers cache.
Keep the source helper, but remove its interpreter-specific compiled
artifact from version control.

Testing: meson test -C build (281 passed, 1 skipped).

Assisted-by: OpenAI Codex <noreply@openai.com>
2026-10-02 04:50:49 -06:00
Behdad Esfahbod 81b68595b1 [subset] Instance FeatureVariationRecord condition formats 2-5
Legacy FeatureVariationRecords forced non-axis conditions to false when
choosing the new default features. Their empty range maps also compared
equal, discarding distinct conditional records during partial instancing.

Evaluate value and boolean conditions against the original GDEF store
at the new default, classify their surviving ranges conservatively, and
avoid range-only deduplication for complex conditions. Reuse the lookup
condition serializer to fold pinned axes and remap variation indices.
Materialize a false condition rather than emitting a null (true) offset.
Remove the unused condition-subset TODO stubs.

Add GSUB/GPOS coverage with 75 full/partial-instancing comparisons of
glyph selection and advances, covering formats 2-5 and null children.

Testing: meson test -C build (281 passed, 1 skipped); C++11 reduced-
feature syntax checks with HB_NO_VAR, HB_NO_BEYOND_64K, HB_NO_CUBIC_GLYF.

Assisted-by: OpenAI Codex <noreply@openai.com>
2026-10-02 04:49:46 -06:00
Behdad Esfahbod 02c6a9f935 [glyf] Preserve cubic control pairing across contours
Starting every contour at its last point rotates all-off-curve cubic
controls by one point, changing the implied curves. Preserve their
original order instead. Reset the second leading control between
contours, and draw a two-control contour as a cubic, not a point.

Add regressions using current MAXP, GLYF, LOCA, HHEA, and HMTX tables
for all-off-curve contours, consecutive contours, and two controls.

Testing: meson test -C build (281 passed, 1 skipped).

Assisted-by: OpenAI Codex <noreply@openai.com>
2026-10-02 04:31:02 -06:00
Behdad Esfahbod 95f11782f1 [test] Remove obsolete loca glyph-count checks
The disabled checks reflect an abandoned beyond-64k proposal that
derived the glyph count from loca. Remove them while retaining the
active maxp compatibility and fallback tests.

Testing: meson test -C build (281 passed, 1 skipped).

Assisted-by: OpenAI Codex <noreply@openai.com>
2026-10-02 04:27:54 -06:00
Behdad Esfahbod def9e67160 [test] Fix null-condition fixture object sizes
Use the real nil Condition for format 0 and provide full-size, aligned
storage for the nested-condition binary fixtures.  This avoids UBSan
object-size violations in test-serialize.

Tested with the combined ASan/UBSan test-serialize target and the full
Meson test suite.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 03:21:22 -06:00
Behdad Esfahbod c2b308a271 [ot] Treat null conditions as true
Condition offsets of zero denote a true condition.  Represent that through
the nil Condition's reserved format 0 in evaluation, dependency collection,
and subsetting, preserving nested null offsets where possible and
materializing top-level nulls as constant-true format 2 conditions.

Add coverage for direct and nested null-condition evaluation, variation
index collection, and serialization.

Tested with the full Meson test suite.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 03:05:32 -06:00
Behdad Esfahbod 4cf1474dfa [repacker] Reset graph state before assigning spaces
Overflow resolution can retry GSUB/GPOS specialization on an already
modified graph.  Clear derived space and priority state before assigning
spaces again so retries do not accumulate stale space identifiers.

Use the full signed range available to the packed distance key instead
of saturating valid distances as the number of spaces grows.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 02:36:32 -06:00
Behdad Esfahbod 22248564c1 [repacker] Move already-isolated overflow roots
Initialize every selected root's incoming-edge count before traversing
their combined subgraph.  This prevents later root initialization from
overwriting counts collected through an earlier root.

An overflow root still needs a new packing space when no duplication is
needed, so move already-isolated roots instead of treating that case as
an unsuccessful resolution attempt.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 02:36:20 -06:00
Behdad Esfahbod 5b104f8afe [repacker] Handle extended layout graphs
Discover GSUB/GPOS 1.2 lookups through LookupList2 and treat the
32-bit lookup-list link like other wide graph roots.  Also preserve
parent multiplicity when identical lookup subtables are promoted to a
shared extension wrapper.

Add coverage for 1.2 extension promotion and repeated subtable links.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 02:35:55 -06:00
Behdad Esfahbod 6b231378b0 [subset] Fix lookup variation debug builds
Initialize the subset context before TRACE_SUBSET uses it.  This keeps
HB_DEBUG_SUBSET builds compiling after LookupVariationRecord support.

Tested with the full Meson test suite and an explicit
HB_DEBUG_SUBSET=100 build.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-02 01:39:25 -06:00
Behdad Esfahbod f072bff4b0 [ot] Exercise GPOS lookup variations
Extend the lookup-variation fixture with a GDEF ItemVariationStore-backed
ConditionValue and a GPOS conditional positioning lookup. This covers
variation-index evaluation, GPOS shaping, and lookup collection while
reusing the existing partial-instancing checks.

Tested with the full Meson suite and OTS validation of the fixture.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 20:40:06 -06:00
Behdad Esfahbod f9141a2776 [ot] Keep lookup-condition subsetting C++11-compatible
Use the concrete condition-offset array type instead of a generic lambda
parameter, since generic lambdas require C++14.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 20:01:40 -06:00
Behdad Esfahbod 3f39e24e75 [subset] Partially instantiate lookup conditions
Reduce LookupVariationRecord conditions to false, true, or a residual
condition when axes are pinned or restricted.  Fold compound AND, OR,
and NOT conditions, remap value-condition variation indices, and emit a
constant condition when a surviving lookup becomes unconditional.

Extend the test font with a second axis and all condition formats so the
subset tests cover structural, full, and partial instancing behavior.

Tested with the full Meson test suite, targeted Clang HB_NO_VAR and GCC
builds, and OTS validation of the fixture.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 19:43:47 -06:00
Behdad Esfahbod c8d6c273fb [subset] Instantiate LookupVariationRecord lookups
Resolve lookup variations at the pinned coordinates and store their final
lookup sets in the subset plan.  Use those sets when serializing the main
Feature tables before dropping FeatureVariations from a full instance.

This reuses the shaping resolver so version 1.0 feature substitutions,
ADD_DEFAULT_LOOKUPS, compound conditions, and GDEF variation data are
evaluated consistently.

Tested with the full Meson test suite and a targeted HB_NO_VAR build.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 19:31:11 -06:00
Behdad Esfahbod 3d6677f05c [subset] Preserve LookupVariationRecord tables
Subset FeatureVariations 1.1 lookup records while remapping feature and
lookup indices.  Preserve all condition formats and remap variation
indices used by value conditions.

Keep features with lookup variations distinct during feature
deduplication, since equal default lookup lists do not imply equal
variable behavior.

Tested with the full Meson test suite and a targeted HB_NO_VAR build.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 19:25:17 -06:00
Behdad Esfahbod 48d97c4ad1 [ot] Collect LookupVariationRecord dependencies
Include conditionally referenced lookups in layout collection, feature
closure, and GSUB dependency data.  Also retain variation indices used
by FeatureVariations conditions in GSUB and GPOS when remapping the
GDEF variation store.

Tested with the full Meson test suite and targeted HB_NO_VAR builds of
the touched runtime translation units.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 19:14:01 -06:00
Behdad Esfahbod 2c05df744c [ot] Support LookupVariationRecord shaping
Parse and sanitize the FeatureVariations 1.1 lookup-oriented records.
Resolve their effective lookup sets while constructing the shape-plan
key so cache entries remain exact without retaining raw coordinates.

Handle ADD_DEFAULT_LOOKUPS, multiple matching conditions, and the
interaction with version 1.0 feature substitutions.  Keep the existing
public FeatureVariations query API behavior unchanged.

Tested with the full Meson test suite.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 19:08:11 -06:00
Behdad Esfahbod c27beebf87 [VORG] Use published versions in tests
Encode versions 1.0 and 2.0 in the VORG fixtures instead of the undefined
minor version 1. The test behavior is unchanged, but the input now conforms
to the final Open Font Format definition.

Tested with test-be-subset-tables and the full Meson suite.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 16:51:20 -06:00
Behdad Esfahbod cba5f9d10d [docs] Remove stale extended-format comments
Update the cmap format 15 and LookupList2 field comments to match the final
Open Font Format text.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 16:50:12 -06:00
Behdad Esfahbod 58a90bf833 [cmap] Support DMAP
Consult DMAP before cmap for nominal and variation mappings, and combine
their character coverage while retaining DMAP precedence. Reuse the cmap
parser and serializer for DMAP, including effective subsetting closure.

Keep DMAP available independently of beyond-64K support; only cmap format
15 remains conditional.

Tested with the full Meson suite and with an HB_NO_BEYOND_64K build.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 16:27:20 -06:00
Behdad Esfahbod 8759f47d64 [subset] Order GVAR after avar2
The avar2 dependency scheduler delayed lowercase gvar until avar had been
subsetted, but omitted the uppercase GVAR companion. Add the same guarded
dependency so extended glyph variations observe the finalized avar2 state.

Tested with the focused avar2 test and the full Meson test suite.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 15:57:17 -06:00
Behdad Esfahbod e109b81788 [GVAR] Correct extended header size
Account for the uint24 glyphCount field when reserving the uppercase
GVAR header. The fixed 20-byte size caused the final byte of the
glyphVariationDataArrayOffset to overlap the first array offset.

Add an exact binary subsetting regression for the 21-byte header.

Testing: meson test -C build --print-errorlogs

Assisted-by: OpenAI Codex
2026-10-01 14:47:15 -06:00
Behdad Esfahbod c0bd381bd7 [subset] Serialize 24-bit chained-rule glyphs
Use the chained rule type width for backtrack, input, and lookahead arrays. The hardcoded 16-bit writes truncated extended glyph IDs and shifted the lookup-record array.

Add a byte-level regression covering all three glyph arrays.

Tested with: meson test -C build --print-errorlogs

Assisted-by: OpenAI Codex
2026-10-01 14:15:54 -06:00
Behdad Esfahbod 31d082d84a [subset] Serialize 24-bit sequence-rule glyphs
Use the rule type width when remapping glyph-keyed sequence rules. Writing HBUINT16 truncated extended glyph IDs and misaligned the following lookup records.

Add a byte-level serializer regression for a remapped glyph above 65535.

Tested with: meson test -C build --print-errorlogs

Assisted-by: OpenAI Codex
2026-10-01 14:14:32 -06:00
Behdad Esfahbod 795224e1b5 [layout] Use Offset24 in ChainedSequenceRuleSet2
The extended chained sequence context format uses Offset24 entries in
its inner ChainedSequenceRuleSet2 array.  Propagate the enclosing format
type to that array instead of always selecting the 16-bit offset type.

Add a compile-time size check for the medium rule-set header and first
offset entry.

Testing: meson test -C build

Assisted-by: OpenAI Codex
2026-10-01 13:32:19 -06:00
Behdad Esfahbod d2e218ac26 [layout] Use 24-bit ClassDef format 3 values
ClassDef format 3 stores startGlyphID, glyphCount, and each class value
as uint24.  Use the medium integer type for the class array, select a
serializable format based on both glyph and class ranges, and keep the
subsetter size estimator in sync.

Test parsing and querying a class value above 65535, and test that the
serializer and size estimator select the matching format.

Testing: meson test -C build

Assisted-by: OpenAI Codex
2026-10-01 13:29:55 -06:00
Behdad Esfahbod 3a5572ee33 [GDEF] Correct LigCaretList2 header size
Account separately for the 32-bit coverage offset and 24-bit ligature
glyph count.  The previous expression treated both fields as 24-bit and
declared a six-byte minimum instead of the required seven bytes.

Add a compile-time assertion for the extended header size.

Testing: meson test -C build

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 13:23:38 -06:00
Behdad Esfahbod 3d5736e8ab [GDEF] Restore version 1.4 header layout
Use the final version 1.4 header with five appended Offset32 fields
instead of the obsolete major-version-2 layout.  Honor each nonzero
Offset2 field in preference to its legacy counterpart when reading and
subsetting the table.

Add a binary regression test that gives the legacy and extended glyph
class definitions different values, ensuring the extended field wins.

Testing: meson test -C build

Assisted-by: OpenAI Codex <codex@openai.com>
2026-10-01 13:21:30 -06:00
Behdad Esfahbod 17af97aae4 Merge remote-tracking branch 'origin/main' into beyond-64k
Reconcile the beyond-64K table type changes with the dependency API,
graph result handling, and variation-budget updates from main. Preserve
the branch's wider table variants while adopting the new behavior.

Build and test with Meson (281 passed, 1 skipped).

Assisted-by: OpenAI Codex <noreply@openai.com>
2026-10-01 12:59:54 -06:00
Behdad EsfahbodandClaude Sonnet 5.5 e6d5454350 [paint] Clamp hb_color_lerp() channels to [0,255] (#6305)
Sweep-gradient color-stop angles come from the font, so the
interpolation fraction t can fall outside [0,1] (or be NaN).  The
interpolated channel was then cast float -> unsigned directly; a
negative value (e.g. -387.671) is UB (UBSan float-cast-overflow) and
yields meaningless colors on release builds.

Clamp the interpolated channel to [0,255], mapping NaN to 0, before
the cast.  In-range behavior is unchanged.  Add the reported fuzzer
input as a seed.

Reported by iceray-Li.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 18:22:41 -06:00
Behdad EsfahbodandClaude Sonnet 5.5 b7fca823a0 [avar] Clamp instantiated axis-value maps to F2DOT14 range (#6303)
AxisValueMap::instantiate() renormalizes the from/to coordinates and
stores them with set_float() without clamping.  With malformed input
the result can fall outside [-1,1] (e.g. 2.192 -> 35923), overflowing
the int16 F2DOT14 storage: UB under UBSan's float-cast-overflow, and a
silently truncated avar table otherwise.

Clamp both coordinates to [-1,1] before storing.  Add the reported
fuzzer input as a seed.

Reported by iceray-Li.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 18:03:28 -06:00
Khaled Hosny eb033319fc 14.5.1 14.5.1 2026-10-01 02:34:38 +03:00
Behdad EsfahbodandClaude Sonnet 5.5 c34f0d97f2 [gpu] Fix 32-bit overflow in hb_gpu_paint_encode() and cap sub-blob bytes (#6301)
* [gpu] Check overflow when summing paint sub-blob sizes

hb_gpu_paint_encode() accumulated the lengths of all sub-blobs into
a 32-bit unsigned without an overflow check, then allocated the
output from the wrapped total.  A COLRv1 font whose paint DAG
revisits a max-size (65535-stop) gradient 4096 times makes the sum
exactly 2^32, so the buffer was tiny while the copy loop wrote the
real data, overflowing the heap.

Use hb_unsigned_add_overflows() for both the sub-blob sum and the
total size, and fail the encode on overflow, as hb_gpu_draw_encode()
already does.

Not added a regression test: triggering it needs ~4 GiB of blobs.
Tests: meson test -C build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* [gpu] Cap total paint sub-blob bytes

Gradient color-stop blobs (up to 1 MiB each) were unmetered, so a
COLRv1 paint DAG revisiting one thousands of times could force
multi-GiB allocations and copies in a single glyph encode.

Route all sub-blob pushes through hb_gpu_paint_t::push_sub_blob(),
which fails (marking the paint unsupported) once the running total
exceeds 64 MiB.

Tests: meson test -C build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 17:17:40 -06:00
Behdad EsfahbodandClaude Sonnet 5 cb995b5754 [ft] Fix self-deadlock in hb_font_destroy() after hb_ft_font_set_funcs() (#6300)
on a stream-backed FT_Face

hb_ft_font_set_funcs() creates its own internal FT_Face from the
font's face blob, and hooks that blob to the FT_Face's generic
finalizer (_release_blob), with the shared static FT_Library hooked
to the blob's user-data destructor (destroy_ft_library).

On hb_font_destroy(), _hb_ft_face_destroy_static() locks
static_ft_library_mutex and calls FT_Done_Face(), which synchronously
runs the finalizer chain: _release_blob() -> hb_blob_destroy(). For a
face created from a custom FreeType stream (FT_OPEN_STREAM), each
hb_face_reference_blob() call synthesizes a brand-new, unshared blob
(via _hb_ft_reference_table()), so this hb_blob_destroy() call drops
it straight to zero, which triggers destroy_ft_library(), which tries
to lock the same non-recursive static_ft_library_mutex again on the
same thread. Self-deadlock.

This didn't reproduce for a file-path or memory-blob face, because
there the blob handed to the internal FT_Face is the same blob shared
by the outer hb_face_t, so the drop inside the lock only decrements
its refcount without reaching zero; the final unref (and
destroy_ft_library() call) happens later, outside the lock, when the
outer face itself is destroyed.

Fix by holding an extra reference on the blob across the locked
FT_Done_Face() call, so it can only reach a zero refcount (and invoke
destroy_ft_library()) after static_ft_library_mutex has been
released. FT_Done_Face() itself remains fully serialized, as intended
by 46644f885d.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6276
Tests: meson test -C build (260/260 passed); added
test_native_ft_set_funcs_stream_face_no_deadlock to test/api/test-ft.c,
which hangs on unfixed code and passes with the fix. Also verified
against the reporter's original repro.c.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-30 16:47:55 -06:00
David Corbett d84e253c0f Map fonupa variant to UPPH language system (#6299) 2026-09-30 15:59:36 -06:00
nussaibah shaikh 3c8a65ed9d [font] fix signed integer overflow in synthetic_glyph_extents (#6296)
* [font] fix signed integer overflow in synthetic_glyph_extents

synthetic_glyph_extents applies synthetic slant and embolden to a
glyph's extents with plain hb_position_t arithmetic: x_bearing +
width and y_bearing + height in the slant branch, plus the += / -=
shifts in the embolden branch. glyf's contour_bounds_t and the sbix
png-dimension path each clamp x_bearing/width and y_bearing/height to
the full hb_position_t range independently via
hb_clamp_to<hb_position_t>(), so one field can reach INT32_MIN/MAX on
its own and the sum overflows, which is undefined behavior (UBSan
signed-integer-overflow at hb-font.hh:221). Reached from
hb_font_get_glyph_extents when synthetic slant/bold is set and the
glyph has extents but no drawable outline.

This is the sibling of 873dbc1 (scale_glyph_extents), which fixed the
same x_bearing + width overflow in the adjacent function. Accumulate
the slant terms in double and the embolden terms in int64, saturating
each result to hb_position_t with hb_clamp_to, matching that fix and
the copy in hb-ft.cc. Valid in-range extents are unchanged.

Add a regression test in test/api/test-font.c that drives the sink
with INT32-extreme extents; it aborts under the asan/ubsan job without
the fix. Full meson test -C build stays green.

* [font] use int64_t for slant accumulation in synthetic_glyph_extents
2026-09-30 13:04:22 -06:00
artemkulyk 82ec48207b [subset] Drop degenerate VariationDevice records (#6286)
After instancing, GDEF maps all-zero delta rows to
HB_OT_LAYOUT_NO_VARIATIONS_INDEX. copy() still emitted a device with
the out-of-range varidx (0xFFFFFFFF), even though the delta is
already folded into the base value.

Drop the device in that case. gdef_partial_instance is marked
no_fonttools since fonttools keeps the dead device; the
empty_region_vardata and update_def_wght expected outputs are
regenerated.

Tested with: meson test -C build

Assisted-by: opencode
2026-09-29 18:09:44 -06:00
Matej Smycka 897f2e0e2c Fix/wasm shape features free (#6291)
* [wasm] Fix memory leak inside _hb_wasm_shape()

Correct variable should be freed otherwise memory leaks inside the
container can take place.

* [wasm] extract features ptr to variable for clarity
2026-09-29 17:16:31 -06:00
artemkulyk 7cc20b8f70 [subset/cmap] Emit idDelta for zero-delta identity runs (#6284)
serialize_rangeoffset_glyid() treated every zero idDelta as "this
range needs a glyphIdArray", which is what to_ranges() emits for
non-run ranges. A real run with delta 0 (glyph id == codepoint) got
the same treatment and cost two bytes per codepoint.

Only zero deltas are ambiguous. Check those against the mapping and
keep the ones that are genuinely identity as delta ranges.

Adds a subset test with a small hand-built glyf font whose cmap maps
U+0001..U+0007 to gids 1..7.

Tested with: meson test -C build

Assisted-by: opencode
2026-09-29 17:11:17 -06:00
Sune Vuorela 8a108d2792 cmake: install relevant headers for harfbuzz-subset (#6295) 2026-09-29 17:10:07 -06:00
dependabot[bot] ff36703b95 Bump github/codeql-action/upload-sarif from 4.38.1 to 4.38.2
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.38.1 to 4.38.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/1c5b675653bb5c22dbe9b12b556ec555138e09fd...2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-28 18:18:13 +03:00
dependabot[bot] ecf81624d2 Bump meson from 1.12.0 to 1.12.1 in /.ci
Bumps [meson](https://github.com/mesonbuild/meson) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.12.0...1.12.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-28 18:17:42 +03:00
Khaled Hosny 409c467b82 [ci] Don’t build glib tests
They seem to build, and we don’t run them anyway.
2026-09-25 19:16:27 +03:00