From 6fbd6bb34e41c34f2591320566b7af7603c3699c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 26 Feb 2025 14:06:35 -0700 Subject: [PATCH] [face] Avoid infinite-loop in building a face blob --- src/hb-face.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-face.cc b/src/hb-face.cc index 793804756..fa8712c13 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -524,9 +524,11 @@ hb_face_reference_blob (hb_face_t *face) hb_face_get_table_tags (face, offset, &count, tags); for (unsigned i = 0; i < count; i++) { - hb_blob_t *table = hb_face_reference_table (face, tags[i]); - hb_face_builder_add_table (builder, tags[i], table); - hb_blob_destroy (table); + if (unlikely (!tags[i])) + continue; + hb_blob_t *table = hb_face_reference_table (face, tags[i]); + hb_face_builder_add_table (builder, tags[i], table); + hb_blob_destroy (table); } }