mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 15:31:05 +01:00
When instancing, the hmtx/vmtx advance is computed by adding the HVAR/VVAR delta to the base advance. The delta is attacker- controlled and unbounded, so the sum can go negative or exceed 65535. The negative case, cast to unsigned, produced advances near 4 billion in hmtx_map; CFF::optimize_widths () then looped over the full [min_w, max_w] width range, taking minutes (the oversized cumsum resize fails cleanly, so this was a pure hang, no memory unsafety). Clamp the computed advance to [0, 0xFFFF], matching the UFWORD range that hmtx/vmtx serialization stores and the hb_max (0.f, …) clamp already used by the runtime metrics path. Fixes a ClusterFuzz timeout in hb-subset-fuzzer (testcase 4846730722738176, minimized from timeout-fd8f4bd2a650). The testcase went from >60s to 5ms; added as a fuzz seed. Full meson test suite passes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>