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

[dfont] Disable null-processsing for offsets

An offset to unsized arrayis not safe to be redirected to our fixed-sized
null pool.  Plus, we want to reject, not repair, bad-looking dfonts.
上级 01b9148d
......@@ -348,7 +348,7 @@ struct ResourceTypeRecord
protected:
Tag tag; /* Resource type. */
HBUINT16 resCountM1; /* Number of resources minus 1. */
OffsetTo<UnsizedArrayOf<ResourceRecord> >
OffsetTo<UnsizedArrayOf<ResourceRecord>, HBUINT16, false>
resourcesZ; /* Offset from beginning of resource type list
* to reference item list for this type. */
public:
......@@ -404,7 +404,7 @@ struct ResourceMap
HBUINT32 reserved1; /* Reserved for handle to next resource map */
HBUINT16 resreved2; /* Reserved for file reference number */
HBUINT16 attrs; /* Resource fork attribute */
OffsetTo<ArrayOfM1<ResourceTypeRecord> >
OffsetTo<ArrayOfM1<ResourceTypeRecord>, HBUINT16, false>
typeList; /* Offset from beginning of map to
* resource type list */
Offset16 nameList; /* Offset from beginning of map to
......@@ -436,10 +436,10 @@ struct ResourceForkHeader
}
protected:
LOffsetTo<UnsizedArrayOf<HBUINT8> >
LOffsetTo<UnsizedArrayOf<HBUINT8>, false>
data; /* Offset from beginning of resource fork
* to resource data */
LOffsetTo<ResourceMap>
LOffsetTo<ResourceMap, false>
map; /* Offset from beginning of resource fork
* to resource map */
HBUINT32 dataLen; /* Length of resource data */
......
......@@ -311,7 +311,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
}
DEFINE_SIZE_STATIC (sizeof(OffsetType));
};
template <typename Type> struct LOffsetTo : OffsetTo<Type, HBUINT32> {};
template <typename Type, bool has_null=true> struct LOffsetTo : OffsetTo<Type, HBUINT32, has_null> {};
template <typename Base, typename OffsetType, bool has_null, typename Type>
static inline const Type& operator + (const Base &base, const OffsetTo<Type, OffsetType, has_null> &offset) { return offset (base); }
template <typename Base, typename OffsetType, bool has_null, typename Type>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册