1
Description: Fix unaligned memory access.
3
Forwarded: http://bugs.php.net/50987
4
Last-Update: 2010-02-09
6
Index: php/ext/phar/phar.c
7
===================================================================
8
--- php.orig/ext/phar/phar.c
9
+++ php/ext/phar/phar.c
10
@@ -512,7 +512,7 @@ void phar_entry_remove(phar_entry_data *
13
# define PHAR_GET_32(buffer, var) \
14
- var = *(php_uint32*)(buffer); \
15
+ memcpy(&var, buffer, sizeof(var)); \
17
# define PHAR_GET_16(buffer, var) \
18
var = *(php_uint16*)(buffer); \
19
@@ -2491,7 +2491,7 @@ static inline void phar_set_32(char *buf
20
*((buffer) + 1) = (unsigned char) (((var) >> 8) & 0xFF);
21
*((buffer) + 0) = (unsigned char) ((var) & 0xFF);
23
- *(php_uint32 *)(buffer) = (php_uint32)(var);
24
+ memcpy(buffer, &var, sizeof(var));