Make hb_array_t::in_range similar to hb_sanitize_context_t::check_range

This commit is contained in:
Ebrahim Byagowi 2019-12-05 13:09:48 +03:30 committed by Behdad Esfahbod
parent b1167d19e9
commit 72d83a0280
1 changed files with 3 additions and 2 deletions

View File

@ -201,8 +201,9 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
hb_enable_if (P == 1)>
bool in_range (const T *p, unsigned int size = T::static_size) const
{
return ((const char *) p) >= arrayZ
&& ((const char *) p + size) <= arrayZ + length;
return arrayZ <= ((const char *) p)
&& ((const char *) p) <= arrayZ + length
&& (unsigned int) (arrayZ + length - (const char *) p) >= size;
}
/* Only call if you allocated the underlying array using malloc() or similar. */