mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 07:21:06 +01:00
reset_recurse_cache() runs once per top-level lookup and cleared completed_recursions and recurse_path_to_index with hb_hashmap_t::clear(), which walks the whole table and keeps its allocated capacity. A single lookup that grew these maps large therefore made every later top-level lookup pay to walk that full capacity, however little it recursed, giving a font with one busy lookup followed by many trivial ones a CPU DoS in hb_subset_depend_from_face_or_fail(). Add clear_or_release(): when a map is large but was left mostly empty by the lookup that just finished, swap in fresh storage before clearing, so later lookups start from a small table. Adds a fuzzer regression font. Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-PNJPHF76. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>