hb_hashmap_t::update() iterates other's items array while inserting
each pair into *this with set(). When other is *this and occupancy
sits on a growth threshold (5 of 8, 10 of 16, ...), the first set()
calls alloc(), which frees the items array the iterator is still
walking, so the rest of the loop reads freed memory. The existing
in_storage() guard only protects set()'s own key/value references,
not this iterator.
Merging a map into itself cannot change it, so make update() a no-op
in that case with an early &other == this return, mirroring the
self-check in hb_vector_t. hb_map_update() is the only caller.
Regression tests are added in src/test-map.cc (including the tombstone
case at 42 used / 10 live slots) and test/api/test-map.c; both fail
under ASan without the fix.
Reported by Anthropic's OSS Scanner as ordinary bug ANT-2026-7TMM2Z2T.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add focused API tests for hb_buffer_create_similar() and buffer
configuration persistence across clear/reset. Also exercise public hb_map
copy, equality, hash, update, iteration, keys, and values paths with
order-independent assertions.
Validation:
meson test -C build-tgl-precheck --print-errorlogs --suite api test-buffer
meson test -C build-tgl-precheck --print-errorlogs --suite api test-map
meson test -C build-tgl-precheck --print-errorlogs --suite api test-buffer test-map
Assisted-by: OpenAI Codex <codex@openai.com>
Co-authored-by: jeffhuang <jeff@docker.xydrsucermoubd24xgo33yhsgd.bx.internal.cloudapp.net>