diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 741ee7c11965a60ec02496af66f870601d1e644a..68b50370fefdc3a6518cf1fc16e42e77ac591b3c 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -242,9 +242,7 @@ struct hb_sanitize_context_t #define SANITIZE_WITH_BASE(B,X) likely ((X).sanitize (context, CharP(B))) -#define SANITIZE_SELF() SANITIZE_MEM(this, sizeof (*this)) - -#define SANITIZE_MEM(B,L) likely (context->check_range (CharP(B), (L))) +#define SANITIZE_SELF() likely(context->check_range (this, sizeof (*this))) /* Template to sanitize an object. */ diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 22a5432af839aa25f11b781c626638bb19305b5e..9b245a1905ffd5b607bc90d1c765aa90e491ff69 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -599,7 +599,7 @@ struct Device inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); return SANITIZE_SELF() - && SANITIZE_MEM (this, this->get_size ()); + && context->check_range (this, this->get_size ()); } private: diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index 98cc371e33e412561fc216bc97a2cfbadf88405c..d41d8a1b8fd9deccdbcb22fb83d43bee28bec705 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -159,7 +159,7 @@ struct ValueFormat : USHORT inline bool sanitize_value (hb_sanitize_context_t *context, void *base, const Value *values) { TRACE_SANITIZE (); - return SANITIZE_MEM (values, get_size ()) + return context->check_range (values, get_size ()) && (!has_device () || sanitize_value_devices (context, base, values)); } diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index bb10bdf4ad37b42a1fc8e5e245bceae7ee568293..86c215320334025f7710ced3d2f3ab5082af324d 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -289,9 +289,9 @@ struct Rule TRACE_SANITIZE (); return SANITIZE (inputCount) && SANITIZE (lookupCount) - && SANITIZE_MEM (input, - input[0].get_size () * inputCount + - lookupRecordX[0].get_size () * lookupCount); + && context->check_range (input, + input[0].get_size () * inputCount + + lookupRecordX[0].get_size () * lookupCount); } private: