From c24ea1036b45ea48ecc3081698ec04be646b74d0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 7 Jul 2023 20:43:20 -0600 Subject: [PATCH] [sanitize] Minor tweak to len=0 case which is handled otherwise anyway --- src/hb-sanitize.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-sanitize.hh b/src/hb-sanitize.hh index 83f8641cf..b6743d0b3 100644 --- a/src/hb-sanitize.hh +++ b/src/hb-sanitize.hh @@ -269,7 +269,7 @@ struct hb_sanitize_context_t : { const char *p = (const char *) base; bool ok = !len || - ((uintptr_t) (p - this->start) < this->length && + ((uintptr_t) (p - this->start) <= this->length && (unsigned int) (this->end - p) >= len && ((this->max_ops -= len) > 0)); @@ -289,7 +289,7 @@ struct hb_sanitize_context_t : unsigned int len) const { const char *p = (const char *) base; - bool ok = ((uintptr_t) (p - this->start) < this->length && + bool ok = ((uintptr_t) (p - this->start) <= this->length && (unsigned int) (this->end - p) >= len); DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0,