mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 15:31:05 +01:00
cff2_cs_interp_env_t::process_blend() evaluates one VarRegionList scalar per entry of the VarData's region indices (up to 65535, each walking up to axisCount axes) the first time a charstring hits `blend`, but the only budget charge for blend is the operand-proportional one in cff2_cs_opset_t::process_blend(), which runs afterwards and is skipped when the operand check fails. So `1 blend` did regionIndexCount x axisCount scalar evaluations for one budget unit, and a VARC fan-out re-ran it tens of thousands of times within 2% of HB_BUDGET_GLYPH. Charge region_count x max(1, axisCount) through the env's existing spend_budget() right before resizing and filling the scalars vector, matching how VARC charges values x coords for its own ItemVariationStore evaluations; a failed charge errors the interpreter exactly as a failed resize does. spend_budget() is a no-op without a budget, so the subsetter and instancer paths are unchanged, and seen_blend gates the work to once per charstring run. Adds test_hb_draw_cff2_blend_region_budget: a CFF2 charstring blending one value over 256 region indices of a 16-axis region list must consume at least 256 x 16 units and fail under a 2048-unit budget. Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-WSM91D3G. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>