From 72c9deb5f1d4870349bbbccef35494fc7a6231e8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 16 Mar 2024 13:50:31 -0600 Subject: [PATCH] [varc] Fixups Seems to work now! --- src/hb-open-type.hh | 3 +-- src/hb-ot-layout-common.hh | 12 +++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 92f467288..77f96b47c 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -1462,10 +1462,9 @@ struct CFFIndex hb_barrier () && (count == 0 || /* empty INDEX */ (count < count + 1u && - hb_barrier () && c->check_struct (&offSize) && offSize >= 1 && offSize <= 4 && c->check_array (offsets, offSize, count + 1u) && - c->check_array ((const HBUINT8*) data_base (), 1, offset_at (count)))))); + c->check_range (data_base (), offset_at (count)))))); } public: diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 6589320d5..5be09dbb7 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -3134,7 +3134,7 @@ struct MultiVarData hb_array_t out, SparseVarRegionList::cache_t *cache = nullptr) const { - auto &deltaSets = StructAfter (regionIndices); + auto &deltaSets = StructAfter (regionIndices); if (unlikely (inner >= deltaSets.count)) return; @@ -3163,18 +3163,20 @@ struct MultiVarData bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && + return_trace (format.sanitize (c) && + hb_barrier () && + format == 1 && regionIndices.sanitize (c) && hb_barrier () && - StructAfter (regionIndices).sanitize (c)); + StructAfter (regionIndices).sanitize (c)); } protected: - HBUINT16 format; // 1 + HBUINT8 format; // 1 Array16Of regionIndices; TupleList deltaSetsX; public: - DEFINE_SIZE_MIN (4 + CFF2Index::min_size); + DEFINE_SIZE_MIN (8); }; struct ItemVariationStore