[vector] Fix OOM handling in SVG subset id collection

hb_svg_add_unique_id() used v->push() and tested the returned
pointer for null. hb_vector_t::push() reports allocation failure via
the vector error state and returns the Crap() sentinel, so the old
check did not reliably stop on OOM.

Check v->in_error() after push() before writing into the new slot.

Assisted-by: OpenAI Codex
This commit is contained in:
Behdad Esfahbod committed 2026-03-10 10:42:29 -03:00
1 parent b6b8f8dcca
commit 4fd90c836a
1 file changed
+2 -1
+2 -1
View File
@@ -178,7 +178,8 @@ hb_svg_add_unique_id (hb_vector_t<OT::SVG::svg_id_span_t> *v,
if (unlikely (!seen_ids->set (key, true)))
return false;
auto *slot = v->push ();
if (!slot) return false;
if (unlikely (v->in_error ()))
return false;
*slot = key;
return true;
}