Files
harfbuzz/test
Behdad EsfahbodandClaude Opus 4.8 fca5fc4e6b [graphite2] Clear positions when the segment has no slots
Every shaper that returns true must leave the buffer with
have_positions set; the OpenType and fallback shapers call
clear_positions() unconditionally.  _hb_graphite2_shape() borrows
pos[] as scratch via get_scratch_buffer(), which clears
have_positions, and the normal path restores it through
hb_buffer_get_glyph_positions().  But when Graphite deletes every
glyph of the run, the zero-slot early-out set buffer->len = 0 and
returned true without restoring the flag, so a later
hb_buffer_normalize_glyphs() (hb-shape --normalize-glyphs) hit
assert (buffer->have_positions) and aborted.

Restore the invariant where it is broken, by calling
buffer->clear_positions() in the empty-segment return.

Adds test_graphite2_all_glyphs_deleted, with an embedded 500-byte
font whose Silf rule deletes 'a'; shaping "aaa" must now succeed with
length 0 and positions, while the "aba" control is unchanged.

Reported by Anthropic's OSS Scanner as ordinary bug ANT-2026-BG9QJRVN.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-30 16:59:32 -06:00
..