src/hb-blob.hh | 2 +- src/hb-ot-color-sbix-table.hh | 6 ------ src/hb-ot-glyf-table.hh | 3 ++- 3 files changed, 3 insertions(+), 8 deletions(-)
New commits: commit 995bf6c6f82d6b2dabcb81e1426910ee82b91b44 Author: Behdad Esfahbod <[email protected]> Date: Wed Oct 31 13:21:33 2018 -0700 [sbix] Rely on blob->as<> checking size against Type::min_size diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index 4feb4e19..065c0dd1 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -243,12 +243,6 @@ struct sbix unsigned int strike_ppem = 0; hb_blob_t *blob = reference_png (font, glyph, &x_offset, &y_offset, &strike_ppem); - if (unlikely (blob->length < sizeof (PNGHeader))) - { - hb_blob_destroy (blob); - return false; - } - const PNGHeader &png = *blob->as<PNGHeader>(); extents->x_bearing = x_offset; commit 4d4e526b5cc703111eb445b7e319a4cd1917489f Author: Behdad Esfahbod <[email protected]> Date: Wed Oct 31 13:19:42 2018 -0700 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. diff --git a/src/hb-blob.hh b/src/hb-blob.hh index 26e2dd70..0181e94a 100644 --- a/src/hb-blob.hh +++ b/src/hb-blob.hh @@ -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 { diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 9437a83d..7bd175e3 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -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); }; _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
