Modify OffsetTo<>::sanitize() overflow check

The code in question was introduced in 70eb2ff682.
Rewrite it to not call sanitizer check_range() as we want to use
check_range() for byte accounting.

Part of https://github.com/harfbuzz/harfbuzz/pull/2923
This commit is contained in:
Behdad Esfahbod 2021-03-31 17:04:02 -06:00
parent 4dba749d83
commit 70110f6aaa
1 changed files with 1 additions and 1 deletions

View File

@ -387,7 +387,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!c->check_struct (this))) return_trace (false); if (unlikely (!c->check_struct (this))) return_trace (false);
if (unlikely (this->is_null ())) return_trace (true); if (unlikely (this->is_null ())) return_trace (true);
if (unlikely (!c->check_range (base, *this))) return_trace (false); if (unlikely ((const char *) base + (unsigned) *this < (const char *) base)) return_trace (false);
return_trace (true); return_trace (true);
} }