提交 fe9bc070 编写于 作者: B Behdad Esfahbod

Fix awful confusion between lookup format and subtable format

As reported by John Daggett.
上级 458ecbb6
...@@ -1458,10 +1458,10 @@ struct PosLookupSubTable ...@@ -1458,10 +1458,10 @@ struct PosLookupSubTable
} }
} }
inline bool sanitize (hb_sanitize_context_t *context) { inline bool sanitize (hb_sanitize_context_t *context, unsigned int lookup_type) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.sub_format.sanitize (context)) return false;
switch (u.format) { switch (lookup_type) {
case Single: return u.single.sanitize (context); case Single: return u.single.sanitize (context);
case Pair: return u.pair.sanitize (context); case Pair: return u.pair.sanitize (context);
case Cursive: return u.cursive.sanitize (context); case Cursive: return u.cursive.sanitize (context);
...@@ -1477,7 +1477,7 @@ struct PosLookupSubTable ...@@ -1477,7 +1477,7 @@ struct PosLookupSubTable
private: private:
union { union {
USHORT format; USHORT sub_format;
SinglePos single; SinglePos single;
PairPos pair; PairPos pair;
CursivePos cursive; CursivePos cursive;
...@@ -1489,7 +1489,7 @@ struct PosLookupSubTable ...@@ -1489,7 +1489,7 @@ struct PosLookupSubTable
ExtensionPos extension; ExtensionPos extension;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, sub_format);
}; };
...@@ -1563,7 +1563,7 @@ struct PosLookup : Lookup ...@@ -1563,7 +1563,7 @@ struct PosLookup : Lookup
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (unlikely (!Lookup::sanitize (context))) return false; if (unlikely (!Lookup::sanitize (context))) return false;
OffsetArrayOf<PosLookupSubTable> &list = CastR<OffsetArrayOf<PosLookupSubTable> > (subTable); OffsetArrayOf<PosLookupSubTable> &list = CastR<OffsetArrayOf<PosLookupSubTable> > (subTable);
return list.sanitize (context, this); return list.sanitize (context, this, get_type ());
} }
}; };
...@@ -1611,7 +1611,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t *context) ...@@ -1611,7 +1611,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t *context)
if (unlikely (!Extension::sanitize (context))) return false; if (unlikely (!Extension::sanitize (context))) return false;
unsigned int offset = get_offset (); unsigned int offset = get_offset ();
if (unlikely (!offset)) return true; if (unlikely (!offset)) return true;
return StructAtOffset<PosLookupSubTable> (this, offset).sanitize (context); return StructAtOffset<PosLookupSubTable> (this, offset).sanitize (context, get_type ());
} }
static inline bool position_lookup (hb_apply_context_t *context, unsigned int lookup_index) static inline bool position_lookup (hb_apply_context_t *context, unsigned int lookup_index)
......
...@@ -730,10 +730,10 @@ struct SubstLookupSubTable ...@@ -730,10 +730,10 @@ struct SubstLookupSubTable
} }
} }
inline bool sanitize (hb_sanitize_context_t *context) { inline bool sanitize (hb_sanitize_context_t *context, unsigned int lookup_type) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!u.format.sanitize (context)) return false; if (!u.sub_format.sanitize (context)) return false;
switch (u.format) { switch (lookup_type) {
case Single: return u.single.sanitize (context); case Single: return u.single.sanitize (context);
case Multiple: return u.multiple.sanitize (context); case Multiple: return u.multiple.sanitize (context);
case Alternate: return u.alternate.sanitize (context); case Alternate: return u.alternate.sanitize (context);
...@@ -748,7 +748,7 @@ struct SubstLookupSubTable ...@@ -748,7 +748,7 @@ struct SubstLookupSubTable
private: private:
union { union {
USHORT format; USHORT sub_format;
SingleSubst single; SingleSubst single;
MultipleSubst multiple; MultipleSubst multiple;
AlternateSubst alternate; AlternateSubst alternate;
...@@ -759,7 +759,7 @@ struct SubstLookupSubTable ...@@ -759,7 +759,7 @@ struct SubstLookupSubTable
ReverseChainSingleSubst reverseChainContextSingle; ReverseChainSingleSubst reverseChainContextSingle;
} u; } u;
public: public:
DEFINE_SIZE_UNION (2, format); DEFINE_SIZE_UNION (2, sub_format);
}; };
...@@ -870,7 +870,7 @@ struct SubstLookup : Lookup ...@@ -870,7 +870,7 @@ struct SubstLookup : Lookup
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (unlikely (!Lookup::sanitize (context))) return false; if (unlikely (!Lookup::sanitize (context))) return false;
OffsetArrayOf<SubstLookupSubTable> &list = CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable); OffsetArrayOf<SubstLookupSubTable> &list = CastR<OffsetArrayOf<SubstLookupSubTable> > (subTable);
return list.sanitize (context, this); return list.sanitize (context, this, get_type ());
} }
}; };
...@@ -918,7 +918,7 @@ inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *context) ...@@ -918,7 +918,7 @@ inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *context)
if (unlikely (!Extension::sanitize (context))) return false; if (unlikely (!Extension::sanitize (context))) return false;
unsigned int offset = get_offset (); unsigned int offset = get_offset ();
if (unlikely (!offset)) return true; if (unlikely (!offset)) return true;
return StructAtOffset<SubstLookupSubTable> (this, offset).sanitize (context); return StructAtOffset<SubstLookupSubTable> (this, offset).sanitize (context, get_type ());
} }
inline bool ExtensionSubst::is_reverse (void) const inline bool ExtensionSubst::is_reverse (void) const
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册