Files
harfbuzz/test
Behdad EsfahbodandClaude Opus 4.8 14e1f86467 [vector] Decline color_glyph in the SVG paint backend
The SVG backend's color_glyph callback re-entered hb_font_paint_glyph()
for every COLRv1 PaintColrGlyph, and each re-entry built a fresh COLR
paint context whose HB_MAX_GRAPH_EDGE_COUNT and HB_MAX_NESTING_LEVEL
counters started over.  The limits therefore applied per nested glyph
instead of per top-level glyph, so a DAG in which each level references
the next one f times was walked f^levels times, letting a sub-2 KB font
spin indefinitely; the same per-re-entry depth reset let a crafted font
overflow a small thread stack.

Return false, as hb-raster and the PDF backend do (and as the COLR and
FreeType walkers expect), so the walker paints the nested glyph inline
in the same context, where the existing decycler, nesting limit and edge
limit bound the whole graph.  The color_glyph_depth counter and
active_color_glyphs set existed only to guard the re-entry, so they are
dropped from hb_vector_paint_t and from create, destroy and clear.

A regression test building a 30-level, 3-reference COLR chain in memory
is added to test/vector/test-vector-budget.c for both SVG and PDF.

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

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-30 14:55:57 -06:00
..