[subset] Couple of fixes for fuzzer discovered issues. (#924) * [subset] sanitize individual DeviceRecord's as part of hdmx sanitization. * [subset] Fix out of bounds read with non-two byte align glyphs. * [subset] Just use size_device_record >= DeviceRecord::min_size. * [subset] Add TODO. * [subset] Re-order checks in hdmx sanitize.
diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 4062c9b..2a2f855 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc
@@ -89,12 +89,16 @@ hb_blob_t *source_blob = sanitizer.sanitize (plan->source->reference_table (TableType::tableTag)); const TableType *table = OT::Sanitizer<TableType>::lock_instance (source_blob); + hb_tag_t tag = TableType::tableTag; hb_bool_t result = false; if (table != &OT::Null(TableType)) + { result = table->subset(plan); + } else { + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG(tag)); + } 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; }