summaryrefslogtreecommitdiff
path: root/thirdparty/harfbuzz/src/hb-aat-layout-common.hh
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-07-24 23:05:03 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-07-24 23:05:03 +0300
commit5f5a9f256cad866172c18939e31162ba038ac02e (patch)
treec0d398d0ae345b40fd7b847057267f4ad1852554 /thirdparty/harfbuzz/src/hb-aat-layout-common.hh
parentb3df27526a0374f2fd5f44eab99da4b4bfd9f9ec (diff)
HarfBuzz: Update to version 5.0.1
Diffstat (limited to 'thirdparty/harfbuzz/src/hb-aat-layout-common.hh')
-rw-r--r--thirdparty/harfbuzz/src/hb-aat-layout-common.hh20
1 files changed, 8 insertions, 12 deletions
diff --git a/thirdparty/harfbuzz/src/hb-aat-layout-common.hh b/thirdparty/harfbuzz/src/hb-aat-layout-common.hh
index 1db0f1df92..6cbed82692 100644
--- a/thirdparty/harfbuzz/src/hb-aat-layout-common.hh
+++ b/thirdparty/harfbuzz/src/hb-aat-layout-common.hh
@@ -415,18 +415,7 @@ struct Lookup
public:
DEFINE_SIZE_UNION (2, format);
};
-/* Lookup 0 has unbounded size (dependant on num_glyphs). So we need to defined
- * special NULL objects for Lookup<> objects, but since it's template our macros
- * don't work. So we have to hand-code them here. UGLY. */
-} /* Close namespace. */
-/* Ugly hand-coded null objects for template Lookup<> :(. */
-extern HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2];
-template <typename T>
-struct Null<AAT::Lookup<T>> {
- static AAT::Lookup<T> const & get_null ()
- { return *reinterpret_cast<const AAT::Lookup<T> *> (_hb_Null_AAT_Lookup); }
-};
-namespace AAT {
+DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 2);
enum { DELETED_GLYPH = 0xFFFF };
@@ -681,6 +670,13 @@ struct ObsoleteTypes
const void *base,
const T *array)
{
+ /* https://github.com/harfbuzz/harfbuzz/issues/3483 */
+ /* If offset is less than base, return an offset that would
+ * result in an address half a 32bit address-space away,
+ * to make sure sanitize fails even on 32bit builds. */
+ if (unlikely (offset < unsigned ((const char *) array - (const char *) base)))
+ return INT_MAX / T::static_size;
+
/* https://github.com/harfbuzz/harfbuzz/issues/2816 */
return (offset - unsigned ((const char *) array - (const char *) base)) / T::static_size;
}