Files
harfbuzz/test/api
Behdad EsfahbodandClaude Opus 4.8 d377bc81f2 [depend] Cap the number of stored dependency-graph edges
hb_depend_data_builder_t::add_edge() stored one record per
(source, target, feature tag) with no bound.  In GSUB a lookup
reached by F feature tags multiplies its N*M substitutions by F, so
a lookup whose covered glyphs all share one AlternateSet, selected
by many feature tags, produces N*M*F edges from a font that grows
only with N+M+F.  A 5 KB font yields 33M edges and ~1.4 GB of
builder memory; COLRv0 overlapping layer slices reach the same sink
without any GSUB.  The builder also kept walking after fail(), so an
allocation failure still cost the full N*M*F iterations.

This adds HB_DEPEND_MAX_EDGES (1<<22, about 4M, next to
HB_MAX_GRAPH_EDGE_COUNT in hb-limits.hh and overridable the same
way; 16x the largest graph in the test corpus) and enforces it in
add_edge(), the single choke point every table's extractor stores
through, so hb_subset_depend_from_face_or_fail() returns NULL
instead of building an unbounded graph.  add_edge() and
add_gsub_lookup() return early once the builder has failed, and
GSUB_accelerator_t::depend()'s lookup loop stops as well, matching
the existing !successful checks in the context walkers, so a failed
build does bounded work.

A regression test builds the fan-out font in memory with
hb_face_builder (no binary test font needed) and checks that a
16x16x4 fan-out is recorded in full and that the 256x256x512 one is
refused.  test-ot-depend and the api suite pass on the ASan
experimental build, and the finding's reproducer now returns NULL
in ~1 s.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-9IOHFFER.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-10 16:38:50 -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