From f5fab0c71837371cce32dc3e9edca1ccb8d44e29 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 6 May 2010 10:26:52 -0400 Subject: [PATCH] Remove SANITIZE_MEM --- src/hb-open-type-private.hh | 4 +--- src/hb-ot-layout-common-private.hh | 2 +- src/hb-ot-layout-gpos-private.hh | 2 +- src/hb-ot-layout-gsubgpos-private.hh | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 741ee7c..68b5037 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 22a5432..9b245a1 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 98cc371..d41d8a1 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 bb10bdf..86c2153 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: -- 2.7.4