From 00360049e3f2b611c886d183c3fe31604426e663 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 13 Mar 2025 16:22:45 -0600 Subject: [PATCH] [directwrite] Handle failures in new API Still crashes... --- src/hb-directwrite.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index b5790bc00..9911dea92 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -903,7 +903,15 @@ hb_directwrite_face_create_from_blob_or_fail (hb_blob_t *blob, unsigned int index) { hb_directwrite_face_data_t *data = _hb_directwrite_face_data_create (blob, index); + if (unlikely (!data)) + return nullptr; + hb_face_t *face = hb_directwrite_face_create (data->fontFace); + if (unlikely (hb_object_is_immutable (face))) + { + _hb_directwrite_shaper_face_data_destroy (data); + return face; + } /* Let there be dragons here... */ face->data.directwrite.cmpexch (nullptr, data);