diff --git a/src/hb-aat-var-hvgl-table.hh b/src/hb-aat-var-hvgl-table.hh index f95143016..f542858ab 100644 --- a/src/hb-aat-var-hvgl-table.hh +++ b/src/hb-aat-var-hvgl-table.hh @@ -395,6 +395,26 @@ struct Index DEFINE_SIZE_MIN (4); }; +template +struct IndexOf : Index +{ + public: + + Type get (unsigned index, unsigned count) const + { + hb_ubytes_t data = Index::get (index, count); + hb_sanitize_context_t c (data.begin (), data.end ()); + Type &item = *reinterpret_cast (data.begin ()); + if (unlikely (!item.sanitize (c))) return Null(Type); + return item; + } + + bool sanitize (hb_sanitize_context_t *c, unsigned count) const + { return Index::sanitize (c, count); } +}; + +using PartsIndex = IndexOf; + struct hvgl { public: @@ -405,7 +425,7 @@ struct hvgl if (unlikely (!c->check_struct (this))) return_trace (false); hb_barrier (); - const auto &parts = StructAtOffset (this, partsOff); + const auto &parts = StructAtOffset (this, partsOff); if (unlikely (!parts.sanitize (c, (unsigned) partCount))) return_trace (false); return_trace (true);