+2025-01-17 Paul Eggert <eggert@cs.ucla.edu>
+
+ crc-x86_64: better fix for unaligned access
+ Avoid undefined behavior in a way that doesn’t require
+ the input buffer to be aligned.
+ From a suggestion by Lasse Collin in:
+ https://lists.gnu.org/r/bug-gnulib/2025-01/msg00148.html
+ * lib/crc-x86_64-pclmul.c (crc32_update_no_xor_pclmul):
+ Since the const void * pointer ‘buf’ might not be aligned,
+ assign it to const __m128i_u * instead of to const __m128i *.
+ * lib/crc.c (crc32_update_no_xor):
+ Remove recently-addeda check for buffer alignment.
+
2025-01-17 Pádraig Brady <P@draigBrady.com>
Avoid -Wformat=security failures with --disable-nls
uint32_t
crc32_update_no_xor_pclmul (uint32_t crc, const void *buf, size_t len)
{
- const __m128i *data = buf;
+ const __m128i_u *data = buf;
__m128i *datarw;
size_t bytes_remaining = len;
__m128i in256[4] = { 0 };
pclmul_checked = true;
}
- if (pclmul_enabled && len >= 16 && (intptr_t) buf % 16 == 0)
+ if (pclmul_enabled && len >= 16)
return crc32_update_no_xor_pclmul (crc, buf, len);
#endif
pclmul_checked = true;
}
- if (pclmul_enabled && len >= 16 && (intptr_t) buf % 16 == 0)
+ if (pclmul_enabled && len >= 16)
return crc32_update_no_xor_pclmul (crc, buf, len);
#endif