Files
nussaibah shaikh c89c0c4aa5 Fix signed overflow sorting axis tags (#6551)
tuple_variations_t::_cmp_axis_tag() subtracted two axis tags as int.
The tags come from the font, so tags far apart in signed range, such
as one with the high bit set, overflow the subtraction during partial
instancing. UBSan reports signed-integer-overflow from
change_tuple_variations_axis_limits(). The wrapped result also makes
the comparator inconsistent, for a sort that exists to keep the
result deterministic.

Use _hb_cmp_operator<hb_tag_t, hb_tag_t>, as other sorts in the tree
do, and drop the local comparator. Printable ASCII tags keep their
order, so valid fonts are unaffected.

Testing: added a 1074-byte fuzzer seed that fails under UBSan without
the fix. meson test -C build-asan passes 100/100 with
-Db_sanitize=address,undefined -Dexperimental_api=true. The build had
no glib, so test/api did not run.

Assisted-by: Claude
2026-11-02 09:13:37 -07:00
..
2020-01-31 16:37:30 -05:00
2022-06-01 07:39:20 -06:00