diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 56914beaee3c7983e64811ffbede7872c7d2e9bb..a6ff6e7b9c66909bc37e719e2a90afc8fc384760 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -302,10 +302,10 @@ struct hb_sanitize_context_t : inline bool check_range (const void *base, unsigned int len) const { const char *p = (const char *) base; - bool ok = this->max_ops-- > 0 && - this->start <= p && + bool ok = this->start <= p && p <= this->end && - (unsigned int) (this->end - p) >= len; + (unsigned int) (this->end - p) >= len && + this->max_ops-- > 0; DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0, "check_range [%p..%p] (%d bytes) in [%p..%p] -> %s",