From 5f1b91a6bfeb349e1113c66885c6d49a47fe76e8 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Sat, 20 Nov 2010 19:27:31 +0000 Subject: [PATCH] Fixed bug #50987 (unaligned memory access in phar.c) --- NEWS | 2 ++ ext/phar/phar.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8cf9294882..20dc231c81 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ - Fixed crashes on invalid parameters in intl extension (Stas, Maksymilian Arciemowicz) - Fixed bug #53362 (Segmentation fault when extending SplFixedArray). (Felipe) +- Fixed bug #50987 (unaligned memory access in phar.c). + (geissert at debian dot org, Ilia) - Fixed bug #47168 (printf of floating point variable prints maximum of 40 decimal places). (Ilia) diff --git a/ext/phar/phar.c b/ext/phar/phar.c index f255537fa7..7ae346d793 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -2491,7 +2491,7 @@ static inline void phar_set_32(char *buffer, int var) /* {{{ */ *((buffer) + 1) = (unsigned char) (((var) >> 8) & 0xFF); *((buffer) + 0) = (unsigned char) ((var) & 0xFF); #else - *(php_uint32 *)(buffer) = (php_uint32)(var); + memcpy(buffer, &var, sizeof(var)); #endif } /* }}} */ -- 2.40.0