From e30e3c2f17fb26cddc91e9f950f6f26948fa8e0e Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 28 Sep 2026 16:15:37 +0100 Subject: Go on past a runaway GSUB as HarfBuzz does A font whose GSUB grows the buffer past its bounds (text-rendering-tests' GSUB-3) made vega_shape fail. HarfBuzz goes on with the glyphs of the last pass that finished: every later pass does nothing, positions are the default advances. Vega's buffer operations already stand still once the buffer is unsuccessful, so it now goes on too, and a broken font shows what HarfBuzz shows rather than nothing. HarfBuzz's suite: 5018 of 5199 the same, none failing. --- text/harfbuzz-suite.known | 3 --- text/shape.c | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'text') diff --git a/text/harfbuzz-suite.known b/text/harfbuzz-suite.known index 76a5be4..ad77ac2 100644 --- a/text/harfbuzz-suite.known +++ b/text/harfbuzz-suite.known @@ -15,6 +15,3 @@ in-house/arabic-fallback-shaping.tests:6 # Myanmar as Zawgyi encodes it (Qaag; refused). in-house/myanmar-zawgyi.tests:* - -# No plan for the run. -text-rendering-tests/GSUB-3.tests:1 diff --git a/text/shape.c b/text/shape.c index 8db4a7a..3ab8245 100644 --- a/text/shape.c +++ b/text/shape.c @@ -4060,7 +4060,9 @@ long vega_shape(VegaShaper *b, const VegaShaping *s, const uint32_t *codes, size info->gprops = gen_cat(info) != VEGA_MN || is_default_ignorable(info) ? BASE_GLYPH : MARK; } apply_table(s, &plan, b, 0); - if (!b->successful || !ensure(b, b->len)) return -1; + /* Past the buffer's bounds (a runaway GSUB), HarfBuzz goes on with the + * glyphs of the last pass that finished, every later pass doing + * nothing; so does this. */ position(s, &plan, b); /* Hide what shows nothing: the space glyph, with nothing to advance. */ @@ -4101,7 +4103,6 @@ long vega_shape(VegaShaper *b, const VegaShaping *s, const uint32_t *codes, size } if (plan.shaper == VEGA_SHAPER_ARABIC) apply_stch(s, b); - if (!b->successful) return -1; if (b->glyphs_allocated < b->len) { VegaShaped *glyphs = realloc(b->glyphs, b->len * sizeof(*glyphs)); -- cgit v1.2.3