Make hb_array_t::in_range similar to hb_sanitize_context_t::check_range
This commit is contained in:
parent
b1167d19e9
commit
72d83a0280
|
@ -201,8 +201,9 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||||
hb_enable_if (P == 1)>
|
hb_enable_if (P == 1)>
|
||||||
bool in_range (const T *p, unsigned int size = T::static_size) const
|
bool in_range (const T *p, unsigned int size = T::static_size) const
|
||||||
{
|
{
|
||||||
return ((const char *) p) >= arrayZ
|
return arrayZ <= ((const char *) p)
|
||||||
&& ((const char *) p + size) <= arrayZ + length;
|
&& ((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. */
|
/* Only call if you allocated the underlying array using malloc() or similar. */
|
||||||
|
|
Loading…
Reference in New Issue