提交 811a651b 编写于 作者: M Michiharu Ariza

fixed bugs with empty CFFIndex, fullset FDMap

上级 5cde2f55
...@@ -59,9 +59,10 @@ struct CFFIndex ...@@ -59,9 +59,10 @@ struct CFFIndex
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) && offSize >= 1 && offSize <= 4 && return_trace (likely ((count.sanitize (c) && count == 0) || /* empty INDEX */
(c->check_struct (this) && offSize >= 1 && offSize <= 4 &&
c->check_array (offsets, offSize, count + 1) && c->check_array (offsets, offSize, count + 1) &&
c->check_array (data_base (), 1, max_offset () - 1))); c->check_array (data_base (), 1, max_offset () - 1))));
} }
inline static unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count) inline static unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count)
...@@ -350,6 +351,20 @@ struct FDMap : hb_vector_t<hb_codepoint_t> ...@@ -350,6 +351,20 @@ struct FDMap : hb_vector_t<hb_codepoint_t>
inline bool excludes (hb_codepoint_t fd) const inline bool excludes (hb_codepoint_t fd) const
{ return (fd < len) && ((*this)[fd] == HB_SET_VALUE_INVALID); } { return (fd < len) && ((*this)[fd] == HB_SET_VALUE_INVALID); }
inline hb_codepoint_t operator[] (hb_codepoint_t i) const
{
if (fullset ())
return i;
else
return hb_vector_t<hb_codepoint_t>::operator[] (i);
}
inline hb_codepoint_t &operator[] (hb_codepoint_t i)
{
assert (i < len);
return hb_vector_t<hb_codepoint_t>::operator[] (i);
}
}; };
template <typename COUNT> template <typename COUNT>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册