mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-29 17:44:06 +01:00
propagate_attachment_offsets() turns a mark's stored attachment into an offset by summing the advances of every glyph between the mark and its base. That distance can be up to 32767 glyphs (the range of attach_chain), and position_finish_offsets() runs the pass once per attached glyph, so the total work is the sum of all mark-to-base distances and is not bounded by the font; it was never charged to buffer->max_ops. Attacker-chosen text over a cooperating font (or the kerx path) could thus make hb_shape() spend several times the budgeted CPU. Thread the buffer into propagate_attachment_offsets() and charge the base-to-mark distance to buffer->max_ops before the summation loops, failing the shape when the budget runs out (the same budget the unsafe_to_break walk over this range already uses). Normal text, whose marks sit next to their base, pays a negligible amount. Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-4JGOSACZ. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>