andrey                                   Thu, 15 Jul 2010 16:57:14 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=301293

Log:
Fix for Bug #51583 Bus error due to wrong alignment in mysqlnd

Bug: http://bugs.php.net/51583 (Re-Opened) Bus error due to wrong alignment in 
mysqlnd
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-07-15 16:43:53 UTC (rev 301292)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-07-15 16:57:14 UTC (rev 301293)
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Jul 2010, PHP 5.3.3
+- Fixed bug #51583 (Bus error due to wrong alignment in mysqlnd). (Rainer Jung)


 15 Jul 2010, PHP 5.3.3 RC3

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c      2010-07-15 
16:43:53 UTC (rev 301292)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c      2010-07-15 
16:57:14 UTC (rev 301293)
@@ -199,7 +199,12 @@


 /* We assume that MYSQLND_HEADER_SIZE is 4 bytes !! */
-#define STORE_HEADER_SIZE(safe_storage, buffer)  int4store((safe_storage), 
(*(uint32_t *)(buffer)))
+#define COPY_HEADER(T,A)  do { \
+               *(((char *)(T)))   = *(((char *)(A)));\
+               *(((char *)(T))+1) = *(((char *)(A))+1);\
+               *(((char *)(T))+2) = *(((char *)(A))+2);\
+               *(((char *)(T))+3) = *(((char *)(A))+3); } while (0)
+#define STORE_HEADER_SIZE(safe_storage, buffer)  COPY_HEADER((safe_storage), 
(buffer))
 #define RESTORE_HEADER_SIZE(buffer, safe_storage) 
STORE_HEADER_SIZE((safe_storage), (buffer))

 /* {{{ mysqlnd_net::send */

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-07-15 16:43:53 UTC (rev 
301292)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-07-15 16:57:14 UTC (rev 
301293)
@@ -199,7 +199,12 @@


 /* We assume that MYSQLND_HEADER_SIZE is 4 bytes !! */
-#define STORE_HEADER_SIZE(safe_storage, buffer)  int4store((safe_storage), 
(*(uint32_t *)(buffer)))
+#define COPY_HEADER(T,A)  do { \
+               *(((char *)(T)))   = *(((char *)(A)));\
+               *(((char *)(T))+1) = *(((char *)(A))+1);\
+               *(((char *)(T))+2) = *(((char *)(A))+2);\
+               *(((char *)(T))+3) = *(((char *)(A))+3); } while (0)
+#define STORE_HEADER_SIZE(safe_storage, buffer)  COPY_HEADER((safe_storage), 
(buffer))
 #define RESTORE_HEADER_SIZE(buffer, safe_storage) 
STORE_HEADER_SIZE((safe_storage), (buffer))

 /* {{{ mysqlnd_net::send */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to