[array/hash] Fix asan issue

../src/hb-algs.hh:240:43: runtime error: reference binding to misaligned address 0x7ffe91a08b0e for type 'const unsigned int', which requires 4 byte alignment
This commit is contained in:
Behdad Esfahbod 2022-11-28 14:12:55 -07:00
parent 26ad7a6022
commit 3131aecf9f
1 changed files with 2 additions and 2 deletions

View File

@ -453,7 +453,7 @@ inline uint32_t hb_array_t<const char>::hash () const
((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__))
struct __attribute__((packed)) packed_uint32_t { uint32_t v; };
for (; i + 4 <= this->length; i += 4)
current = current * 31 + hb_hash (((packed_uint32_t *) &this->arrayZ[i])->v);
current = current * 31 + hb_hash ((uint32_t) ((packed_uint32_t *) &this->arrayZ[i])->v);
#endif
for (; i < this->length; i++)
@ -471,7 +471,7 @@ inline uint32_t hb_array_t<const unsigned char>::hash () const
((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__))
struct __attribute__((packed)) packed_uint32_t { uint32_t v; };
for (; i + 4 <= this->length; i += 4)
current = current * 31 + hb_hash (((packed_uint32_t *) &this->arrayZ[i])->v);
current = current * 31 + hb_hash ((uint32_t) ((packed_uint32_t *) &this->arrayZ[i])->v);
#endif
for (; i < this->length; i++)