mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 14:31:10 +01:00
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