From 76d5482a7c6bfc1b10de0b925c229a9cdd220977 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Mon, 5 Dec 2022 19:40:49 +0000 Subject: [PATCH] [subset] always return a valid face from hb_subset_preprocess. --- src/hb-subset-input.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index 05d70ffa7..5165a7904 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -464,6 +464,8 @@ HB_EXTERN hb_face_t * hb_subset_preprocess (hb_face_t *source) { hb_subset_input_t* input = hb_subset_input_create_or_fail (); + if (!input) + return source; hb_set_clear (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE)); hb_set_invert (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE)); @@ -505,6 +507,11 @@ hb_subset_preprocess (hb_face_t *source) hb_face_t* new_source = hb_subset_or_fail (source, input); hb_subset_input_destroy (input); + if (!new_source) { + DEBUG_MSG (SUBSET, nullptr, "Preprocessing failed due to subset failure."); + return source; + } + return new_source; } #endif