Files
harfbuzz/src/OT
Behdad Esfahbod 7caf17adce [VARC] Share a work budget across leaf glyf/CFF glyph loads
VARC bounds its own composite-graph traversal (edge count, nesting
depth, decycler), and each leaf glyph loaded from glyf/CFF/CFF2 is
bounded by that table's per-glyph limit (HB_GLYF_MAX_POINTS,
HB_CFF_MAX_OPS), but the two budgets multiply: one composite glyph
can reference thousands of components, each drawing a leaf glyph
worth 200k points/ops, timing out the fuzzer.

Add a budget_left counter to hb_varc_context_t, initialized once per
top-level get_path/get_extents entry to the new HB_VARC_MAX_WORK
limit and shared by all leaf loads.  Leaf loaders report their
consumption through a new optional int64_t *budget parameter:  glyf
charges the points it processed (scratch.all_points holds exactly
this glyph's points), and the CFF/CFF2 charstring interpreter charges
executed ops, threaded through get_path/get_extents(_at) of both
tables.  Once the budget is exhausted, remaining leaves are skipped
best-effort; a single in-flight leaf may overshoot by at most one
per-glyph limit.  Existing callers (hb-ot-font) pass no budget and
are unchanged.  CFF1 seac component recursion is left uncharged; it
is bounded at two extra charstrings per gated leaf.

Reduces the hb-gpu-fuzzer reproducer (VARC components each loading
large glyf leaf glyphs) from 3.75s to 0.13s locally (was >60s on
instrumented ClusterFuzz builds); rendering of the VARC hanzi and
hangul test fonts is byte-identical before and after.  Full test
suite passes.

Assisted-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 14:16:57 -06:00
..
2026-07-30 19:02:25 -06:00