mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-23 07:51:10 +01:00
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