Skip to content

Commit

Permalink
[kern2] Fix sanitize issue on 32bit systems
Browse files Browse the repository at this point in the history
Fixes #3483
  • Loading branch information
behdad committed Jun 29, 2022
1 parent 32e542d commit c69ec6f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/hb-aat-layout-common.hh
Expand Up @@ -681,6 +681,13 @@ struct ObsoleteTypes
const void *base,
const T *array)
{
/* https://github.com/harfbuzz/harfbuzz/issues/3483 */
/* If offset is less than base, return an offset that would
* result in an address half a 32bit address-space away,
* to make sure sanitize fails even on 32bit builds. */
if (offset < unsigned ((const char *) array - (const char *) base))
return INT_MAX / T::static_size;

/* https://github.com/harfbuzz/harfbuzz/issues/2816 */
return (offset - unsigned ((const char *) array - (const char *) base)) / T::static_size;
}
Expand Down

0 comments on commit c69ec6f

Please sign in to comment.