AnchorMatrix's offset array size was multiplied in unsigned arithmetic.
A small vertex with 46341 rows could therefore be accepted as a
46341-column matrix, leading to excessive work and allocation during
subtable splitting. PairPosFormat2 had the same problem on 32-bit
platforms.
Use the existing size_t saturating multiply helper and compare against
the payload length after checking the header. This preserves the width
of PairPosFormat2's size computation and avoids overflow in the header
addition as well.
Add bounded internal vertex tests for wrapping dimensions, exact valid
sizes, truncated payloads and headers, and empty matrices. The anchor
regression fails against the unchanged code without large allocations.
Discovered by Anthropic's OSS Scanner, as vulnerability
ANT-2026-7E6A2QQS.
Testing: meson compile -C build -j4; meson test -C build
(all 274 tests passed).
Assisted-by: OpenAI Codex
Ligature split points skipped null offsets while the ranges used to
clone and shrink subtables counted every slot. Advance the split index
for null offsets too, so both stages refer to the same ligatures.
Also reject an inverted range after narrowing it to the remaining
links, before calculating the number of ligatures to allocate.
Add a regression that compares the split graph with the expected
subtables when one ligature set has trailing null offsets.
Testing: meson test -C build (292 passed; check-symbols skipped on
macOS), plus the repacker test and shared-ligature font check with
ASan and UBSan.
Discovered by Anthropic's OSS Scanner, as vulnerability
ANT-2026-9C9WB0KM.
Assisted-by: OpenAI Codex
Discover GSUB/GPOS 1.2 lookups through LookupList2 and treat the
32-bit lookup-list link like other wide graph roots. Also preserve
parent multiplicity when identical lookup subtables are promoted to a
shared extension wrapper.
Add coverage for 1.2 extension promotion and repeated subtable links.
Assisted-by: OpenAI Codex <codex@openai.com>
None of the traversals require DFS order so BFS can be used instead which eliminates the possibility of stack overflow. For the queue we re-use the existing ordering_scratch_ space to avoid allocating any additional memory. As a bonus this fixes a bug in find_32bit_roots() that was the result of DFS traversal order.
All of the directed traversal methods are unified to a single common implementation.
* [subset-repack] fix potential out of bounds accesses
make sure we create a deep copy of the object before we mutate
* [subset-repack] fix is_shared(): only check real parents
* [subset-repack] add tests
* [subset-repack] apply AI proposed change
* address review comments
* [subset-repack] no need to duplicate shared liga_sets beforehand
Since we now would create a memory copy of the object before mutating
it, I think checking and duplicating shared liga_sets is not needed.
* [subset-repack] fix potential out of bounds accesses
make sure we create a deep copy of the object before we mutate
* [subset-repack] fix is_shared(): only check real parents
* [subset-repack] add tests
* [subset-repack] apply AI proposed change
* address review comments
* [subset-repack] no need to duplicate shared liga_sets beforehand
Since we now would create a memory copy of the object before mutating
it, I think checking and duplicating shared liga_sets is not needed.
Prior to this change the object id for a vertex in the repacker graph is it's position in the topological ordering. As a result after each sorting the object ids change. This decouples the topological sorting from the object id assignments. A separate ordering list is retained. This simplifies handling around object ids which no longer needs to account for them shifting, and improves performance by eliminating the step of reassigned link object ids after each sort.
When attempting to fix overflows nodes that have incoming edges from more than one parent can be duplicated. However, if all of these incoming links are virtual except for one duplicating it will effectively orphan it (one of the copies will be pointed to only by virtual links). Since parent book keeping is expensive we don't want to separately track virtual/real parents so instead just don't duplicate nodes that have at least one incoming virtual link.
Replaces a check for an exact match on the final serialized bytes. The previous check enforced equivalent topological sorting between result and expected, but we only really care that the graph's are equivalent and don't overflow.