mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-19 05:51:05 +01:00
The hint-dropping and subr-closure walks enforce kMaxCallLimit themselves, because the recorded call graph can nest deeper than the interpreter allows or be cyclic. Hitting the limit failed the whole subset, and the hint-dropping walk signalled it by writing -1 into the shared work budget, conflating "too deep" with "out of budget" and clobbering the budget for later passes. Make both walks best-effort at the limit: the closure walk keeps the subr it reached but does not walk into it, and the hint-dropping walk does not walk into the subr and keeps the call and its hints. Only running out of the work budget fails the subset now, so drop_hints_param_t no longer needs set_error() and the budget is only ever touched by hb_budget_spend(). Walks that follow the interpreter's path never reach the limit, so real fonts are unaffected; for fonts whose records diverge the output may keep a few hints or call a subr whose callees were not retained, but no longer fails. test_subset_cff1_subr_loop now also asserts that the subset succeeds; it failed before this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>