Files
harfbuzz/test/api
Behdad EsfahbodandClaude Opus 4.8 6620feeae2 [buffer] Add missing immutable checks to two setters and create_similar
Every hb_buffer_set_*() is meant to be a no-op on an immutable
buffer, which is what keeps the static _hb_Null_hb_buffer_t
(returned by hb_buffer_get_empty(), and by hb_buffer_create() on
allocation failure) inert.  Three entry points skipped that guard:

 - hb_buffer_set_not_found_variation_selector_glyph() stored into
   the singleton;
 - hb_buffer_guess_segment_properties() wrote direction and
   language into it;
 - hb_buffer_create_similar() called similar() on the singleton
   when its internal hb_buffer_create() failed, copying the source
   buffer's settings onto the shared empty buffer and leaking a
   reference to its unicode funcs.

Add the same hb_object_is_immutable() early return the sibling
setters use, and guard the create_similar() allocation-failure path
the way hb_font_create_sub_font() already does.  No other public
setter in hb-buffer.cc lacks the check.  No API/ABI change; the
only behaviour change is that these calls on the empty buffer now
do nothing, as the documented object model promises.

A regression check is appended to test_buffer_empty().

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

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-30 15:21:14 -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