“bb8646d8340fa7c1b66a037428e39f85f8738f0a”上不存在“arch/sparc/mm/tsb.c”
未验证 提交 b8b00fb3 编写于 作者: E Ebrahim Byagowi 提交者: GitHub

[aat] Support Lookup<OffsetTo<>>, needed by just and lcar (#1368)

上级 073d0a9f
...@@ -58,6 +58,11 @@ struct LookupFormat0 ...@@ -58,6 +58,11 @@ struct LookupFormat0
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (arrayZ.sanitize (c, c->get_num_glyphs ())); return_trace (arrayZ.sanitize (c, c->get_num_glyphs ()));
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (arrayZ.sanitize (c, c->get_num_glyphs (), base));
}
protected: protected:
HBUINT16 format; /* Format identifier--format = 0 */ HBUINT16 format; /* Format identifier--format = 0 */
...@@ -80,6 +85,11 @@ struct LookupSegmentSingle ...@@ -80,6 +85,11 @@ struct LookupSegmentSingle
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && value.sanitize (c)); return_trace (c->check_struct (this) && value.sanitize (c));
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && value.sanitize (c, base));
}
GlyphID last; /* Last GlyphID in this segment */ GlyphID last; /* Last GlyphID in this segment */
GlyphID first; /* First GlyphID in this segment */ GlyphID first; /* First GlyphID in this segment */
...@@ -105,6 +115,11 @@ struct LookupFormat2 ...@@ -105,6 +115,11 @@ struct LookupFormat2
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (segments.sanitize (c)); return_trace (segments.sanitize (c));
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (segments.sanitize (c, base));
}
protected: protected:
HBUINT16 format; /* Format identifier--format = 2 */ HBUINT16 format; /* Format identifier--format = 2 */
...@@ -135,6 +150,14 @@ struct LookupSegmentArray ...@@ -135,6 +150,14 @@ struct LookupSegmentArray
first <= last && first <= last &&
valuesZ.sanitize (c, base, last - first + 1)); valuesZ.sanitize (c, base, last - first + 1));
} }
template <typename T2>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T2 user_data) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
first <= last &&
valuesZ.sanitize (c, base, last - first + 1, user_data));
}
GlyphID last; /* Last GlyphID in this segment */ GlyphID last; /* Last GlyphID in this segment */
GlyphID first; /* First GlyphID in this segment */ GlyphID first; /* First GlyphID in this segment */
...@@ -162,6 +185,11 @@ struct LookupFormat4 ...@@ -162,6 +185,11 @@ struct LookupFormat4
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (segments.sanitize (c, this)); return_trace (segments.sanitize (c, this));
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (segments.sanitize (c, this, base));
}
protected: protected:
HBUINT16 format; /* Format identifier--format = 4 */ HBUINT16 format; /* Format identifier--format = 4 */
...@@ -183,6 +211,11 @@ struct LookupSingle ...@@ -183,6 +211,11 @@ struct LookupSingle
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && value.sanitize (c)); return_trace (c->check_struct (this) && value.sanitize (c));
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && value.sanitize (c, base));
}
GlyphID glyph; /* Last GlyphID */ GlyphID glyph; /* Last GlyphID */
T value; /* The lookup value (only one) */ T value; /* The lookup value (only one) */
...@@ -207,6 +240,11 @@ struct LookupFormat6 ...@@ -207,6 +240,11 @@ struct LookupFormat6
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (entries.sanitize (c)); return_trace (entries.sanitize (c));
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (entries.sanitize (c, base));
}
protected: protected:
HBUINT16 format; /* Format identifier--format = 6 */ HBUINT16 format; /* Format identifier--format = 6 */
...@@ -233,6 +271,11 @@ struct LookupFormat8 ...@@ -233,6 +271,11 @@ struct LookupFormat8
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount)); return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount));
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && valueArrayZ.sanitize (c, glyphCount, base));
}
protected: protected:
HBUINT16 format; /* Format identifier--format = 8 */ HBUINT16 format; /* Format identifier--format = 8 */
...@@ -328,6 +371,20 @@ struct Lookup ...@@ -328,6 +371,20 @@ struct Lookup
default:return_trace (true); default:return_trace (true);
} }
} }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
switch (u.format) {
case 0: return_trace (u.format0.sanitize (c, base));
case 2: return_trace (u.format2.sanitize (c, base));
case 4: return_trace (u.format4.sanitize (c, base));
case 6: return_trace (u.format6.sanitize (c, base));
case 8: return_trace (u.format8.sanitize (c, base));
case 10: return_trace (false); /* No need to support format10 apparently */
default:return_trace (true);
}
}
protected: protected:
union { union {
......
...@@ -833,6 +833,17 @@ struct VarSizedBinSearchArrayOf ...@@ -833,6 +833,17 @@ struct VarSizedBinSearchArrayOf
return_trace (false); return_trace (false);
return_trace (true); return_trace (true);
} }
template <typename T>
inline bool sanitize (hb_sanitize_context_t *c, const void *base, T user_data) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
unsigned int count = header.nUnits;
for (unsigned int i = 0; i < count; i++)
if (unlikely (!(*this)[i].sanitize (c, base, user_data)))
return_trace (false);
return_trace (true);
}
template <typename T> template <typename T>
inline const Type *bsearch (const T &key) const inline const Type *bsearch (const T &key) const
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册