提交 4134ec13 编写于 作者: B Behdad Esfahbod

[dfont] Sanitize only sfnt resources as OpenTypeFontFile

上级 6b5e4d07
...@@ -300,7 +300,7 @@ struct ResourceRefItem ...@@ -300,7 +300,7 @@ struct ResourceRefItem
HBINT16 id; /* Resource ID, is really should be signed? */ HBINT16 id; /* Resource ID, is really should be signed? */
HBINT16 nameOffset; /* Offset from beginning of resource name list HBINT16 nameOffset; /* Offset from beginning of resource name list
* to resource name, minus means there is none. */ * to resource name, -1 means there is none. */
HBUINT8 attr; /* Resource attributes */ HBUINT8 attr; /* Resource attributes */
HBUINT24 dataOffset; /* Offset from beginning of resource data to HBUINT24 dataOffset; /* Offset from beginning of resource data to
* data for this resource */ * data for this resource */
...@@ -374,7 +374,7 @@ struct ResourceMap ...@@ -374,7 +374,7 @@ struct ResourceMap
inline const PString& get_name (const ResourceRefItem &item, inline const PString& get_name (const ResourceRefItem &item,
unsigned int i) const unsigned int i) const
{ {
if (item.nameOffset == -1) if (item.nameOffset < 0)
return Null (PString); return Null (PString);
return StructAtOffset<PString> (this, nameList + item.nameOffset); return StructAtOffset<PString> (this, nameList + item.nameOffset);
...@@ -452,8 +452,11 @@ struct ResourceForkHeader ...@@ -452,8 +452,11 @@ struct ResourceForkHeader
for (unsigned int j = 0; j < type.get_resource_count (); ++j) for (unsigned int j = 0; j < type.get_resource_count (); ++j)
{ {
const LArrayOf<HBUINT8>& data = get_data (type, j); const LArrayOf<HBUINT8>& data = get_data (type, j);
if (unlikely (!(data.sanitize (c) && if (unlikely (!data.sanitize (c)))
((OpenTypeFontFace&) data.arrayZ).sanitize (c)))) return_trace (false);
if (unlikely (type.is_sfnt () &&
!((OpenTypeFontFace&) data.arrayZ).sanitize (c)))
return_trace (false); return_trace (false);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册