diff options
author | Sascha Schumann <sas@php.net> | 2000-12-06 21:24:10 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2000-12-06 21:24:10 +0000 |
commit | fb87cc8c8e4ba3962736266d1dba20ce640088b4 (patch) | |
tree | 3125389ce576f133d26fa827577514c625f18cdc /Zend/zend_hash.c | |
parent | b03af37e1927f31c1d98cc0a3bc0165d878bbe0e (diff) | |
download | php-git-fb87cc8c8e4ba3962736266d1dba20ce640088b4.tar.gz |
INIT_DATA/UPDATE_DATA assumed that pData elements of the size of a void
pointer would actually be aligned like a void pointer. This lead
to bus errors on architectures which don't allow unaligned 32-bit accesses.
Diffstat (limited to 'Zend/zend_hash.c')
-rw-r--r-- | Zend/zend_hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 4d258b7759..8bcfe946e0 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -155,7 +155,7 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength) if (!(p)->pDataPtr) { \ pefree((p)->pData, (ht)->persistent); \ } \ - (p)->pDataPtr = *(void **)pData; \ + memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \ (p)->pData = &(p)->pDataPtr; \ } else { \ if ((p)->pDataPtr) { \ @@ -167,7 +167,7 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength) #define INIT_DATA(ht, p, pData, nDataSize); \ if (nDataSize == sizeof(void*)) { \ - (p)->pDataPtr = *(void **)pData; \ + memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \ (p)->pData = &(p)->pDataPtr; \ } else { \ (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \ |