From 4fd90c836a66aea9d7b8dda3ba40cda98a0dc392 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 10 Mar 2026 10:42:29 -0300 Subject: [PATCH] [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 --- src/hb-vector-svg-subset.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-vector-svg-subset.cc b/src/hb-vector-svg-subset.cc index d0b35c60c..3cc06a916 100644 --- a/src/hb-vector-svg-subset.cc +++ b/src/hb-vector-svg-subset.cc @@ -178,7 +178,8 @@ hb_svg_add_unique_id (hb_vector_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; }