Files
harfbuzz/test/api/fonts
nussaibah shaikh 3fff90528d clamp variable advance before unsigned conversion (#6395)
get_advance_with_var_unscaled adds the HVAR/VVAR advance delta to the
base advance and returns the sum as unsigned. The delta from
ItemVariationStore::get_delta is an unbounded float, so an HVAR whose
item-variation store uses long-word (int32) deltas across several
regions that all peak at the axis extreme can make advance + roundf
(delta) exceed the unsigned range; converting that float to unsigned is
then undefined behavior (UBSan float-cast-overflow), and hb_max (0.0f,
NaN) would likewise pass NaN to the conversion. Reached from the public
hb_font_get_glyph_h_advance / v_advance on a variable font.

Clamp the accumulated value into the unsigned range with hb_clamp_to
before returning, matching the saturation already used for the
variation-derived glyph-extents arithmetic. Valid advances are
unchanged. The template is shared by hmtx/HVAR and vmtx/VVAR, so all
three advance sites are covered.

Add a regression test under test/api driving a crafted long-word HVAR;
it reports float-cast-overflow under the sanitizers job without the fix
and passes with it. The full meson test suite passes.
2026-10-14 10:51:09 -06:00
..
2018-11-25 01:16:01 -05:00
2020-01-23 10:50:52 -08:00
2023-01-24 18:08:22 -07:00
2018-11-03 22:28:30 +03:30
2018-10-18 13:04:41 -07:00
2018-10-22 10:17:31 +02:00
2018-10-22 10:17:31 +02:00
2020-01-31 16:37:30 -05:00
2022-02-18 18:27:02 -06:00
2022-12-23 13:37:59 -07:00
2020-01-15 13:36:01 -08:00
2020-01-15 13:36:01 -08:00
2020-02-06 11:35:48 +03:30

cmap-format12-only files created by ttx & remove all other cmap entries

Inconsolata-Regular.abc.widerc.ttf has the hmtx width of "c" set to 600; everything else is 500. Subsetting out c should reduce numberOfHMetrics to 1.

chromacheck-* fonts are from https://github.com/RoelN/ChromaCheck/tree/master/fonts and licensed under MIT by Roel Nieskens and Google.

RanaKufi-Regular.subset.otf is from https://github.com/alif-type/rana-kufi/ but the subset is licensed for us in MIT for the project use.

glyphs.ttf is from https://github.com/RazrFalcon/ttf-parser/blob/337e7d1/tests/fonts/glyphs.ttf

Estedad-VF.ttf, licensed under OFL 1.1, is from https://github.com/aminabedi68/Estedad