[PATCH] Improve endian conversion in umac.c
Thorsten Glaser
t.glaser at tarent.de
Wed Mar 9 10:32:52 AEDT 2022
On Tue, 8 Mar 2022, rapier wrote:
> + UINT32 temp = *(UINT32 *)ptr;
Can you guarantee it’s aligned? Otherwise, SIGBUS. Maybe not on x86,
other platforms exist and enforce that though (x86’ll just slowdown).
> + *(UINT32 *)ptr = (i >> 24) | ((i & 0x00FF0000) >> 8 )
> + | ((i & 0x0000FF00) << 8 ) | (i << 24);
Can you guarantee it’s aligned *and* not UB? Otherwise, a version of
GCC, possibly a future one, is guaranteed to miscompile that and
pinskia will tell you it’s a feature…
bye,
//mirabilos
--
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
****************************************************
/⁀\ The UTF-8 Ribbon
╲ ╱ Campaign against Mit dem tarent-Newsletter nichts mehr verpassen:
╳ HTML eMail! Also, https://www.tarent.de/newsletter
╱ ╲ header encryption!
****************************************************
More information about the openssh-unix-dev
mailing list