_hb_face_builder_get_table_tags() copied every key out of the hash map
and qsort()ed it on each call, so a caller paging through the list (the
subsetter uses 32-entry pages in hb_subset_plan_execute_or_fail() and
_is_table_present()) paid N/32 sorts of N tags per enumeration. With
the 65535-table face that hb_subset_preprocess() hands back this was
~25 s of CPU per hb_subset_or_fail() call.
Keep an hb_vector_t<hb_tag_t> next to the map and maintain it in
hb_face_builder_add_table(), the only place keys are inserted: a binary
search finds the slot, the vector is pre-allocated before the map is
touched so an allocation failure leaves both structures unchanged, and
the slot is opened with the same resize+memmove idiom hb-bit-set.hh
uses. The getter becomes a sub_array() copy, so enumeration is O(page)
and the returned order is unchanged. _hb_face_builder_data_reference_blob()
keeps its own sort, which orders by blob size, not by tag.
A regression test adds tags out of order, one of them twice, and checks
that paging with a 4-entry array returns each tag once in ascending
order.
Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-VENZFNXH.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>