Files
harfbuzz/test/api
Behdad EsfahbodandClaude Opus 4.8 02b4120e34 [shape-plan] Install buffer work limits in hb_shape_plan_execute()
The per-text limits max_len/max_ops are set by hb_buffer_t::enter() and
reset by leave(), but since e246723f0 only hb_shape_full() called them,
so the public hb_shape_plan_execute() ran the shapers with the idle
defaults (0x3FFFFFFF glyphs / 0x1FFFFFFF ops).  A client that executes a
plan itself could be made to allocate gigabytes or spend seconds of CPU
on a single character.  A reused buffer also kept its spent op budget
across executions, silently skipping nested lookups afterwards.

Move the enter()/leave() pair from hb_shape_full() into the
HB_SHAPER_EXECUTE step of _hb_shape_plan_execute_internal(), the single
point every public path reaches the shapers through, so each call gets a
fresh allowance.  It runs after the empty-buffer early return, so the
immutable empty buffer is never written.

enter() now runs on every shape, so guard against discarding a limit
that internal code narrowed below the idle default before shaping (the
output-growth fault injection in src/test-graphite2-buffer.cc sets
max_len that way): compute the per-text limit as before, but keep the
stricter value when the current limit is already below the default.
Public paths always arrive at the idle defaults (from hb_buffer_create()
or leave()), so they get exactly the computed per-text limit as today;
reused buffers are refilled because leave() restores the defaults first.

hb_shape_full()'s VERIFY pass now runs after leave(), which is harmless:
it reshapes fragment copies via hb_shape_full() (which install their own
limits) and does not read max_len/max_ops.  No API/ABI change.

A regression test in test/api/test-shape-plan.c asserts that
hb_shape_plan_execute() yields the same buffer length as hb_shape().

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

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