bpo-28055: fix unaligned accesses in siphash24() by DerDakon · Pull Request #6123 · python/cpython

serhiy-storchaka

@serhiy-storchaka serhiy-storchaka changed the title fix unaligned accesses in siphash24() bpo-28055: fix unaligned accesses in siphash24()

Mar 26, 2018

serhiy-storchaka

serhiy-storchaka

serhiy-storchaka

@DerDakon

The hash implementation casts the input pointer to uint64_t* and directly reads
from this, which may cause unaligned accesses. Use memcpy() instead so this code
will not crash with SIGBUS on sparc.

https://bugs.gentoo.org/show_bug.cgi?id=636400

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

May 13, 2018
The hash implementation casts the input pointer to uint64_t* and directly reads
from this, which may cause unaligned accesses. Use memcpy() instead so this code
will not crash with SIGBUS on sparc.

https://bugs.gentoo.org/show_bug.cgi?id=636400
(cherry picked from commit 1e2ec8a)

Co-authored-by: Rolf Eike Beer <eike@sf-mail.de>

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

May 13, 2018
The hash implementation casts the input pointer to uint64_t* and directly reads
from this, which may cause unaligned accesses. Use memcpy() instead so this code
will not crash with SIGBUS on sparc.

https://bugs.gentoo.org/show_bug.cgi?id=636400
(cherry picked from commit 1e2ec8a)

Co-authored-by: Rolf Eike Beer <eike@sf-mail.de>

miss-islington added a commit that referenced this pull request

May 13, 2018
The hash implementation casts the input pointer to uint64_t* and directly reads
from this, which may cause unaligned accesses. Use memcpy() instead so this code
will not crash with SIGBUS on sparc.

https://bugs.gentoo.org/show_bug.cgi?id=636400
(cherry picked from commit 1e2ec8a)

Co-authored-by: Rolf Eike Beer <eike@sf-mail.de>

miss-islington added a commit that referenced this pull request

May 13, 2018
The hash implementation casts the input pointer to uint64_t* and directly reads
from this, which may cause unaligned accesses. Use memcpy() instead so this code
will not crash with SIGBUS on sparc.

https://bugs.gentoo.org/show_bug.cgi?id=636400
(cherry picked from commit 1e2ec8a)

Co-authored-by: Rolf Eike Beer <eike@sf-mail.de>

matoro added a commit to matoro/cpython that referenced this pull request

Jun 22, 2022
Like python#6123 this pointer may be
unaligned, so a memcpy() instead of simple assignment is required for
strict architectures e.g. sparc.