Files
harfbuzz/test/api
Behdad EsfahbodandClaude Opus 4.8 cf9889b73f [aat] Reject kern/kerx/mort/morx tables declaring too many subtables
The kern/kerx accelerator keeps two hb_bit_set_t per subtable and
mort/morx keeps one per subtable, all built eagerly when the shape
plan is compiled and held for the life of the face.  A 14-byte kern
format-3 subtable fills both sets with every glyph, so heap use was
about 2100x the font size with nothing bounding the subtable count;
morx is worse because overlapping chains can claim each other's
subtables.  A ~560 KB kern font drove shaping one letter to 1.1 GiB.

Add HB_AAT_MAX_SUBTABLES (1024) to hb-limits.hh and enforce it in
sanitize, the way GSUB/GPOS already bound their subtables via
visit_subtables (whose 0x4000 limit is too loose here -- 16383 kern
subtables still peak at hundreds of MiB).  KerxTable::sanitize()
(shared by kerx, OpenType kern and Apple kern) fails when tableCount
exceeds the limit, and mortmorx::sanitize() fails once the chains'
subtable counts add up past it.  Over-limit tables are dropped
entirely (the font shapes without kerning/morx); real fonts under
test/ declare at most three kern/kerx subtables and one morx chain.

Regression test in test/api/test-aat-layout.c builds kern and morx
faces with hb_face_builder and checks both sides of the limit.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-5N52Y0UN.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-02 10:51:40 -06:00
..
2025-04-06 18:08:50 -06:00
2026-07-30 19:02:25 -06:00
2026-07-31 04:31:26 +03:00
2025-04-05 22:37:10 -06:00
2020-01-15 13:36:01 -08:00
2025-06-08 13:43:27 +03:00