+2025-01-16 Paul Eggert <eggert@cs.ucla.edu>
+
+ crc-x86_64: fix unaligned access
+ Problem reported by Bruno Haible in:
+ https://lists.gnu.org/r/bug-gnulib/2025-01/msg00142.html
+ * lib/crc.c (crc32_update_no_xor): Don’t pass unaligned buffer to
+ crc32_update_no_xor_pclmul. No doubt there is a higher
+ performance fix, perhaps involving advancing byte-by-byte along
+ the buffer until we get to an aligned boundary, but at least this
+ should fix the alignment bug.
+
2025-01-16 Bruno Haible <bruno@clisp.org>
getopt-posix: Fix compilation error in C++ mode (regression 2024-09-21).
pclmul_checked = true;
}
- if (pclmul_enabled && len >= 16)
- return crc32_update_no_xor_pclmul(crc, buf, len);
+ if (pclmul_enabled && len >= 16 && (intptr_t) buf % 16 == 0)
+ return crc32_update_no_xor_pclmul (crc, buf, len);
#endif
slice_alignment = (len & (-8));
pclmul_checked = true;
}
- if (pclmul_enabled && len >= 16)
- return crc32_update_no_xor_pclmul(crc, buf, len);
+ if (pclmul_enabled && len >= 16 && (intptr_t) buf % 16 == 0)
+ return crc32_update_no_xor_pclmul (crc, buf, len);
#endif
for (n = 0; n < len; n++)