mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-28 00:59:16 +01:00
[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:
1 parent
b6b8f8dcca
commit
4fd90c836a
1 file changed
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user