mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 06:51:01 +01:00
context_depend_recurse_lookups tracks covered sequence positions in a fixed hb_bit_page_t, but the dependency-graph path never bounded inputCount the way the shaping apply path does. A crafted GSUB contextual rule with glyphCount past the page (e.g. 512) and a SubstLookupRecord whose sequenceIndex lands in a higher page element than endIndex makes hb_bit_page_t::add_range compute its memset length as (char*)lb - (char*)la, which is negative and wraps to a huge size_t, writing past the stack-allocated page. Reachable from hb_subset_depend_from_face_or_fail on a crafted face. Cap inputCount at HB_MAX_CONTEXT_LENGTH before the page is used, matching the apply path; rules longer than that never apply during shaping, so no real dependency edges are lost. Adds a regression seed exercised by the depend fuzzer.