Commit Graph
21484 Commits
Author SHA1 Message Date
Shubham Gupta 5b54d30ce7 hardcoded version string to lock shared library object name for aix platform 2026-07-29 20:33:19 +03:00
Behdad Esfahbod f26e0cd4ed [instancer] Fix HVAR partial instancing for map-less advance mappings (#6070)
* [instancer] Don't dedup VarStore rows when not optimizing

as_item_varstore dropped duplicate delta rows even with optimize=false,
where varidx_map is left empty and callers rely on original
VariationIndex values staying valid.  HVAR/VVAR subsetting uses that
mode when the source table has an implicit (map-less) advance mapping:
any two glyphs sharing identical deltas shifted every following row, so
the synthesized identity map pointed at wrong rows and past the end of
the VarData — advances silently froze or took neighbors' deltas when
partially instancing such fonts (e.g. Source Han fonts).

Fixes https://github.com/harfbuzz/harfbuzz/issues/6068

* [subset] Drop identity advance maps for map-less HVAR/VVAR sources

When the source table uses implicit glyph-id indexing, the subsetter
synthesized an advance DeltaSetIndexMap whose content was the identity
over every output glyph — equivalent to the implicit indexing it
replaced, just bigger.  Recognize that case in is_identity () and keep
the output map-less, like fontTools does.  Sources that carry a real
map keep one, preserving their form; truncated maps don't qualify since
glyphs past their end share the last value.

retain-num-glyphs expected files regenerated: NotoSansJP-VF.subset.otf
is map-less, and its redundant identity map is now dropped (verified
against fontTools output).

* [test/subset] Test partial instancing of map-less HVAR

ImplicitHVAR.ttf carries an HVAR with implicit (map-less) advance
indexing and deliberately duplicated delta rows, the combination that
broke before the row-dedup fix: rows shifted or fell off the end of the
rebuilt VarData and advances silently froze.  Expected outputs are
cross-checked against fontTools varLib.instancer + subset.
2026-07-29 11:29:23 -06:00
nussaibah shaikh 8c9307b59a [raster] clamp coordinates before converting to int (#6090)
* [raster] clamp coordinates before converting to int

the transformed glyph extents and the flattened segment endpoints are floats derived from int32 inputs and can land far outside the int range, so the conversions were undefined and the extent subtraction overflowed on top of that. saturate through a shared helper and widen the subtraction.

* [raster] generalize int32 saturating cast into hb_clamp_to<>

Move the raster-local hb_raster_clamp_to_int32 helper into hb-algs.hh
as a generic hb_clamp_to<T> that saturates a floating-point value to
the range of any integer type, and use hb_clamp_to<int32_t> at the
three raster call sites.

Signed-off-by: nussaiba shaikh <nussaibah@bugqore.com>

---------

Signed-off-by: nussaiba shaikh <nussaibah@bugqore.com>
2026-07-29 02:59:29 -06:00
Behdad Esfahbod da7f951ef0 Add more hb_barrier()s in switches (#6106)
Fixes https://github.com/harfbuzz/harfbuzz/security/advisories/GHSA-pmg2-m89x-pc6j
2026-07-27 19:20:18 -06:00
Khaled Hosny f3dea1e602 [subset] Add HB_SUBSET_FLAGS_CFF_IDENTITY_CHARSET
When set and subsetting a CID-keyed CFF font, the output charset is
written as identity: CID = new GID.
2026-07-27 22:12:16 +03:00
nussaibah shaikh 884f5a7991 [subset] guard scalars resize in cff2-to-cff1 blend encoder (#6093) 2026-07-27 10:59:22 -06:00
Behdad Esfahbod 72c6c3c757 [MSVC] Suppress another unused-var warning
Fixes https://github.com/harfbuzz/harfbuzz/issues/6095
2026-07-27 10:56:27 -06:00
Khaled Hosny 59b6e1c147 Fix upload-sarif version number comment [ci skip]
Hopefully the bot will keep it updated next time.
2026-07-27 14:50:51 +03:00
dependabot[bot] 4643e3b4c8 Bump ossf/scorecard-action from 2.4.3 to 2.4.4
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.3 to 2.4.4.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/4eaacf0543bb3f2c246792bd56e8cdeffafb205a...2d1146689b8cda280b9bc96326124645441f03bc)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-27 14:49:08 +03:00
dependabot[bot] 16ecba7c57 Bump actions/checkout from 7.0.0 to 7.0.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0...3d3c42e5aac5ba805825da76410c181273ba90b1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-27 14:47:34 +03:00
dependabot[bot] 04b410b157 Bump github/codeql-action/upload-sarif from 4.37.1 to 4.37.3
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.37.1 to 4.37.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/7188fc363630916deb702c7fdcf4e481b751f97a...e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-27 14:47:08 +03:00
Behdad Esfahbod c2b72d76d8 [buffer-verify] Fix OOM condition typo
Fixes https://github.com/harfbuzz/harfbuzz/issues/6097
2026-07-26 17:05:29 -06:00
Thalha Ahmed 34baf8d4cd Add hb_malloc2/hb_realloc2 for overflow-checked array allocation (#6099)
Add internal ALWAYS_INLINE helpers hb_malloc2(nmemb, size) and
hb_realloc2(ptr, nmemb, size) in hb-algs.hh that check for
multiplication overflow before calling hb_malloc/hb_realloc.

Convert call sites that had unchecked n * sizeof(T) multiplications:
  - src/OT/glyf/glyf-helpers.hh
  - src/hb-cairo-utils.cc
  - src/hb-gpu-paint.cc
  - src/hb-map.hh
  - src/hb-ot-post-table.hh
  - src/hb-shape.cc

Also fix raw malloc/free in src/main.cc to use hb_malloc/hb_free.
2026-07-26 11:19:11 -06:00
Hanyu Wang d65aa90ea6 [buffer] Set content_type only for the format actually being parsed (#6092)
hb_buffer_deserialize_unicode() and hb_buffer_deserialize_glyphs() each
mutated the buffer's content_type unconditionally before checking
whether the caller-supplied format was recognized, then returned false
without rolling that back for an invalid format. A buffer left with
content_type set but len == 0 fails the assert_glyphs() /
assert_unicode() invariant on a later, independent call that expects
a clean buffer, aborting the process:

  - deserialize_unicode(INVALID) -> deserialize_glyphs() aborts in
    assert_glyphs().
  - deserialize_glyphs(INVALID) -> add_codepoints() aborts in
    assert_unicode().

Move each hb_buffer_set_content_type() call into the TEXT/JSON case
bodies of the existing format switch, instead of guarding it with a
separate validity check ahead of the switch. The switch's own case
list is already the single source of truth for which formats are
supported, so this avoids duplicating that knowledge in a second
condition that could drift out of sync with the switch.

Testing:
  - Built with -Db_sanitize=address,undefined.
  - Reproduced both original aborts against the unfixed code
    (SIGABRT via assert_glyphs()/assert_unicode()).
  - Rebuilt with the fix and reran both reproducers: clean exit, no
    assertion failure.
  - Ran the full test suite (meson test, sanitizer build, FreeType +
    ICU enabled) before and after: 71/75 pass in both, with the same
    4 pre-existing failures unrelated to buffer serialization
    (check-libstdc++, and the experimental vector/raster/gpu-fuzzer
    chunk 2 targets) - confirmed to fail identically on the
    unmodified baseline, so no regressions from this change.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-24 15:35:58 -06:00
Sai Asish Y cce964cb4f [ot-tag] guard against NULL language in hb_ot_tags_to_script_and_language (#6085)
hb_ot_tag_to_language returns NULL for HB_OT_TAG_DEFAULT_LANGUAGE, and hb_language_to_string returns NULL for it, so the script-suffix path called strlen on a NULL pointer whenever the primary script tag did not match the input. Skip the suffix construction when there is no base language string and leave the default (NULL) language in place.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
2026-07-21 18:47:36 -06:00
nussaibah shaikh 53900fd388 [gpu] bound clip depth in push_clip_path_end (#6073)
push_clip_path_end wrote clip_stack[clip_depth] without the
HB_GPU_PAINT_MAX_CLIP_DEPTH check that push_clip_glyph and
push_clip_path_start both apply. clip_depth can be pushed past
the fixed 3-entry clip_stack, so closing a clip path while the
stack is full writes a pending_clip_t past the array. Guard it
like the sibling clip pushes.
2026-07-21 18:45:53 -06:00
nussaibah shaikh 387ab23f7f [raster] Reject non-finite texel coords in hb_raster_paint_image (#6082)
The range test guarding the bilinear sampler is comparison-based, so NaN
coordinates pass it and reach (int) floorf() in
hb_raster_sample_bilinear_premul, where only x1/y1 are clamped.  The
determinant guard has the same shape, so a transform that overflows to
infinity is accepted and 1/inf turns inf * 0 into NaN.
2026-07-21 18:40:41 -06:00
nussaibah shaikh 8b14f7b217 [colr] clamp alpha and radius deltas before unsigned conversion (#6087)
font-supplied F2DOT14 alpha and variable radius deltas can be negative,
and converting a negative float to unsigned is undefined behavior.
2026-07-21 18:38:27 -06:00
Behdad Esfahbod 38976fba5c [config] Never set HB_NO_CFF here
It was affecting subsetting library unintentionally.

https://github.com/harfbuzz/harfbuzz/pull/6009#issuecomment-4988163042
2026-07-21 14:53:15 -06:00
Qunxin Liu 2c875edbb6 [subset-repack] bug fixes (#6088)
* [subset-repack] fix potential out of bounds accesses

make sure we create a deep copy of the object before we mutate

* [subset-repack] fix is_shared(): only check real parents

* [subset-repack] add tests

* [subset-repack] apply AI proposed change

* address review comments

* [subset-repack] no need to duplicate shared liga_sets beforehand

Since we now would create a memory copy of the object before mutating
it, I think checking and duplicating shared liga_sets is not needed.
2026-07-21 11:49:06 -06:00
Qunxin Liu 8207419e0a [subset-repack] increase REPACKER_MAX_VERTICES limit to 800000 2026-07-21 11:16:26 -06:00
Behdad Esfahbod fc85680fec Revert "[subset-repack] bug fixes (#6077)"
This reverts commit 0b590d6b54.
2026-07-21 10:59:48 -06:00
Qunxin Liu 0b590d6b54 [subset-repack] bug fixes (#6077)
* [subset-repack] fix potential out of bounds accesses

make sure we create a deep copy of the object before we mutate

* [subset-repack] fix is_shared(): only check real parents

* [subset-repack] add tests

* [subset-repack] apply AI proposed change

* address review comments

* [subset-repack] no need to duplicate shared liga_sets beforehand

Since we now would create a memory copy of the object before mutating
it, I think checking and duplicating shared liga_sets is not needed.
2026-07-21 10:55:43 -06:00
dependabot[bot] ac9227e0a2 Bump actions/setup-python from 6.3.0 to 7.0.0
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6.3.0 to 7.0.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/ece7cb06caefa5fff74198d8649806c4678c61a1...5fda3b95a4ea91299a34e894583c3862153e4b97)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-20 13:29:56 +03:00
dependabot[bot] 3372624c66 Bump github/codeql-action/upload-sarif from 4.37.0 to 4.37.1
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.37.0 to 4.37.1.
- [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/99df26d4f13ea111d4ec1a7dddef6063f76b97e9...7188fc363630916deb702c7fdcf4e481b751f97a)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-20 13:27:00 +03:00
Khaled Hosny 53d292f0d1 [introspection] Fix introspection warnings
Fixes https://github.com/harfbuzz/harfbuzz/issues/4875
2026-07-20 13:26:30 +03:00
Khaled Hosny 6fa49d36f0 [docs] Fix reference to non-existent hb_face_create_from_blob_or_fail 2026-07-20 13:26:05 +03:00
Nussu06 af192b7e0f [gpu] Validate extents fit i16 before quantizing 2026-07-18 07:26:32 -06:00
Nussu06 1737bce456 [subset] bound cvar tuple data length in calculate_cvt_deltas 2026-07-18 07:25:19 -06:00
Nussu06 9de7e9d563 [paint] pass color_glyph its own user_data
The dispatch wrapper handed the callback user_data->push_clip_glyph
instead of user_data->color_glyph, so a client registering both
callbacks with different contexts got the wrong pointer on every
COLR glyph.
2026-07-17 11:43:34 -06:00
dependabot[bot] 0577ee23cf Bump meson from 1.11.1 to 1.11.2 in /.ci
Bumps [meson](https://github.com/mesonbuild/meson) from 1.11.1 to 1.11.2.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.11.1...1.11.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-17 11:18:22 +03:00
dependabot[bot] f2ab271c1f Bump github/codeql-action/upload-sarif from 4.36.3 to 4.37.0
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.36.3 to 4.37.0.
- [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/54f647b7e1bb85c95cddabcd46b0c578ec92bc1a...99df26d4f13ea111d4ec1a7dddef6063f76b97e9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-17 11:17:24 +03:00
Qunxin Liu af85ffc449 [subset] increase HB_MAX_FEATURE_INDICES limit to 8000
A realistic font file reaches 1512 feature indices, so increase the max
limit
2026-07-15 11:05:53 -06:00
Garret Rieger d7861576ae More fixes for review comments. 2026-07-14 16:26:49 -06:00
Garret Rieger 2725565dab Address review comments. 2026-07-14 16:26:49 -06:00
Garret Rieger 99380f0e44 Add new hb_subset_input_to_command_line_or_fail().
This generates an equivalent hb-subset command line string for a given subset input.

Assisted by gemini.
2026-07-14 16:26:49 -06:00
Behdad Esfahbod 946901f88d [svg] Use ISALNUM, not isalnum 2026-07-14 16:00:07 -06:00
Behdad Esfahbod 4fbbe7ae4f [ot-font] Invalidate vertical origin cache on scale change
The vertical-origin cache stores scaled y-origin values, but it was
validated against serial_coords. Changing only the font scale leaves
serial_coords unchanged, so hb_font_set_scale() could keep serving stale
vertical origins.

Validate scale-dependent OT font caches against the full font serial and
check that serial before using the batched vertical-origin callback. Add
an API regression that changes y_scale on one font and verifies the
vertical origin is recomputed.

Testing:
meson compile -C build test/api/test-ot-face
meson test -C build test-ot-face --print-errorlogs
meson test -C build --suite api --print-errorlogs

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6066
Assisted-by: OpenAI Codex
2026-07-14 14:02:38 -06:00
Behdad Esfahbod 88e09bb1dc Merge pull request #4710 from harfbuzz/cff2-instancing-try2
Trying to partial-instance CFF2
2026-07-14 14:02:20 -06:00
Behdad Esfahbod 8d2d5174ea Merge pull request #6056 from harfbuzz/paint-fill-glyph
Fix hb-vector rendering of COLRv0 layers with huge font scales
2026-07-14 12:32:22 -06:00
Khaled Hosny bbcd7d6562 [doc/paint] Mention the decomposed fallback sequence for fill-glyph 2026-07-14 01:27:09 +03:00
Khaled Hosny e2588968ae [COLR] Emit fill_glyph for glyph clips with a solid paint
Detect the fill-glyph pattern in the COLRv1 graph: a PaintGlyph whose
child is a (Var)PaintSolid, and emit a single fill_glyph instead of
push_clip_glyph + color + pop_clip.
2026-07-12 22:20:21 +03:00
Khaled Hosny bc00cd8fb5 [fontations] Use fill_glyph for solid glyph fills 2026-07-12 21:16:46 +03:00
Khaled Hosny b4ed968183 [test/paint] Test the fill_path callback 2026-07-12 19:36:15 +03:00
Khaled Hosny 884a591273 [raster] Implement fill_glyph callback 2026-07-12 19:21:47 +03:00
Khaled Hosny bec75aa881 [cairo] Implement fill_glyph callback 2026-07-12 15:14:00 +03:00
Khaled Hosny afda4215dd [ft] Use fill_glyph for COLRv0 layers 2026-07-12 03:26:26 +03:00
Behdad Esfahbod 907579859f [gobject] Drop const attribute from enum get_type declarations (#6061)
GLib removed G_GNUC_CONST from generated get_type declarations because
GType registration can initialize state and the attribute can cause
miscompilations with GCC trunk.

Match that behavior for generated GObject enum declarations.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6060

Assisted-by: OpenAI Codex
2026-07-10 01:59:59 -06:00
Behdad Esfahbod 5e887d3672 Fix previous commit 2026-07-09 12:14:33 -06:00
Behdad Esfahbod b011381764 Ignore -Wunused-template
Fixes https://github.com/harfbuzz/harfbuzz/issues/6059
2026-07-09 12:09:39 -06:00