From fc16b923135bf1670f6791d3998aeb19edde1ca5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 22 Aug 2013 10:56:50 +0200 Subject: [PATCH] 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. --- NEWS | 2 ++ Zend/zend_execute.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 75a0b3c6b9..6d62951e75 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 a17f10b312..35c5bcaef1 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); } -- 2.40.0