mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 22:41:10 +01:00
Improve blob->as<>
It's true that blob->as<> should only be called on null or sanitized data. But this change is safe, so keep it.
This commit is contained in:
1 parent
5854d3fa25
commit
4d4e526b5c
2 files changed
+3
-2
No files matched your search
+1
-1
@@ -60,7 +60,7 @@ struct hb_blob_t
|
||||
template <typename Type>
|
||||
inline const Type* as (void) const
|
||||
{
|
||||
return unlikely (!data) ? &Null(Type) : reinterpret_cast<const Type *> (data);
|
||||
return length < Type::min_size ? &Null(Type) : reinterpret_cast<const Type *> (data);
|
||||
}
|
||||
inline hb_bytes_t as_bytes (void) const
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ struct loca
|
||||
|
||||
protected:
|
||||
UnsizedArrayOf<HBUINT8> dataZ; /* Location data. */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (0, dataZ);
|
||||
};
|
||||
|
||||
@@ -484,7 +485,7 @@ struct glyf
|
||||
|
||||
protected:
|
||||
UnsizedArrayOf<HBUINT8> dataZ; /* Glyphs data. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (0, dataZ);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user