Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a17b6bb

Browse files
committed
Issue #20162: Fix an alignment issue in the siphash24() hash function which
caused a crash on PowerPC 64-bit (ppc64).
1 parent 606ab03 commit a17b6bb

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Release date: 2014-02-09
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #20162: Fix an alignment issue in the siphash24() hash function which
14+
caused a crash on PowerPC 64-bit (ppc64).
15+
1316
Library
1417
-------
1518

Python/pyhash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ siphash24(const void *src, Py_ssize_t src_sz) {
399399
case 7: pt[6] = m[6];
400400
case 6: pt[5] = m[5];
401401
case 5: pt[4] = m[4];
402-
case 4: *((PY_UINT32_T*)&pt[0]) = *((PY_UINT32_T*)&m[0]); break;
402+
case 4: Py_MEMCPY(pt, m, sizeof(PY_UINT32_T)); break;
403403
case 3: pt[2] = m[2];
404404
case 2: pt[1] = m[1];
405405
case 1: pt[0] = m[0];

0 commit comments

Comments
 (0)