mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 22:41:10 +01:00
Rule::collect_second_glyphs() resolved the second input glyph of a class-based contextual rule by scanning the whole input ClassDef once per rule, so a RuleSet with many rules sharing one large ClassDef was quadratic in collect_glyphs() (and thus in subsetting). Collect the needed classes into a set and walk each ClassDef once for all of them: add ClassDef::collect_classes(), and have collect_second_glyphs() accumulate the classes and resolve them in a single pass. The collected sets are identical; only the work is reduced. Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-5FCXNOQF. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>