[Python-checkins] cpython: Issue #20162: Fix an alignment issue in the siphash24() hash function which

victor.stinner python-checkins at python.org
Sat Feb 1 03:39:20 CET 2014


http://hg.python.org/cpython/rev/caebb4f231da
changeset:   88875:caebb4f231da
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Feb 01 03:38:56 2014 +0100
summary:
  Issue #20162: Fix an alignment issue in the siphash24() hash function which
caused a crash on PowerPC 64-bit (ppc64).

files:
  Misc/NEWS       |  3 +++
  Python/pyhash.c |  2 +-
  2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 Core and Builtins
 -----------------
 
+- Issue #20162: Fix an alignment issue in the siphash24() hash function which
+  caused a crash on PowerPC 64-bit (ppc64).
+
 Library
 -------
 
diff --git a/Python/pyhash.c b/Python/pyhash.c
--- a/Python/pyhash.c
+++ b/Python/pyhash.c
@@ -399,7 +399,7 @@
         case 7: pt[6] = m[6];
         case 6: pt[5] = m[5];
         case 5: pt[4] = m[4];
-        case 4: *((PY_UINT32_T*)&pt[0]) = *((PY_UINT32_T*)&m[0]); break;
+        case 4: Py_MEMCPY(pt, m, sizeof(PY_UINT32_T)); break;
         case 3: pt[2] = m[2];
         case 2: pt[1] = m[1];
         case 1: pt[0] = m[0];

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list