Commit:    fc16b923135bf1670f6791d3998aeb19edde1ca5
Author:    Nikita Popov <ni...@php.net>         Thu, 22 Aug 2013 10:56:50 +0200
Parents:   11087eece75786fd053161b431de056bf1052380
Branches:  PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=fc16b923135bf1670f6791d3998aeb19edde1ca5

Log:
Fix bug #46311: Pointer aliasing issue results in miscompile on gcc4.4

The code violated the strict aliasing restriction, because it
dereferenced the same pointer as zval** once and as void**
afterwards. Now both occurances dereference void** and cast to
zval* in the former case.

Bugs:
https://bugs.php.net/46311

Changed paths:
  M  NEWS
  M  Zend/zend_execute.h


Diff:
diff --git a/NEWS b/NEWS
index 75a0b3c..6d62951 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ PHP                                                             
           NEWS
     --enable-dtrace). (Chris Jones, Kris Van Hees)
   . Fixed bug #65225 (PHP_BINARY incorrectly set). (Patrick Allaert)
   . Fixed bug #62692 (PHP fails to build with DTrace). (Chris Jones, Kris Van 
Hees)
+  . Fixed bug #46311 (Pointer aliasing issue results in miscompile on gcc4.4).
+    (Nikita Popov)
 
 - cURL:
   . Fixed bug #65458 (curl memory leak). (Adam)
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index a17f10b..35c5bca 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -293,7 +293,7 @@ static zend_always_inline void 
zend_vm_stack_clear_multiple(int nested TSRMLS_DC
        void **end = p - (int)(zend_uintptr_t)*p;
 
        while (p != end) {
-               zval *q = *(zval **)(--p);
+               zval *q = *(--p);
                *p = NULL;
                i_zval_ptr_dtor(q ZEND_FILE_LINE_CC);
        }


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

Reply via email to