From ec302ad5bda6bea870f6d33f9698a1782472a213 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Thu, 22 Feb 2018 11:57:35 -0800 Subject: [PATCH] [subset] Fail subset if a table fails to sanitize. --- src/hb-subset.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/hb-subset.cc b/src/hb-subset.cc index a9f599f93..b7d3e3710 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -83,16 +83,19 @@ template static bool _subset (hb_subset_plan_t *plan) { - OT::Sanitizer sanitizer; - hb_blob_t *source_blob = sanitizer.sanitize (plan->source->reference_table (TableType::tableTag)); - const TableType *table = OT::Sanitizer::lock_instance (source_blob); - hb_bool_t result = table->subset(plan); + OT::Sanitizer sanitizer; - hb_blob_destroy (source_blob); + hb_blob_t *source_blob = sanitizer.sanitize (plan->source->reference_table (TableType::tableTag)); + const TableType *table = OT::Sanitizer::lock_instance (source_blob); - hb_tag_t tag = TableType::tableTag; - DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset %s", HB_UNTAG(tag), result ? "success" : "FAILED!"); - return result; + hb_bool_t result = false; + if (table != &OT::Null(TableType)) + result = table->subset(plan); + + hb_blob_destroy (source_blob); + hb_tag_t tag = TableType::tableTag; + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset %s", HB_UNTAG(tag), result ? "success" : "FAILED!"); + return result; }