Skip to content

Commit fc16b92

Browse files
committed
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.
1 parent 11087ee commit fc16b92

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PHP NEWS
77
--enable-dtrace). (Chris Jones, Kris Van Hees)
88
. Fixed bug #65225 (PHP_BINARY incorrectly set). (Patrick Allaert)
99
. Fixed bug #62692 (PHP fails to build with DTrace). (Chris Jones, Kris Van Hees)
10+
. Fixed bug #46311 (Pointer aliasing issue results in miscompile on gcc4.4).
11+
(Nikita Popov)
1012

1113
- cURL:
1214
. Fixed bug #65458 (curl memory leak). (Adam)

Zend/zend_execute.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static zend_always_inline void zend_vm_stack_clear_multiple(int nested TSRMLS_DC
293293
void **end = p - (int)(zend_uintptr_t)*p;
294294

295295
while (p != end) {
296-
zval *q = *(zval **)(--p);
296+
zval *q = *(--p);
297297
*p = NULL;
298298
i_zval_ptr_dtor(q ZEND_FILE_LINE_CC);
299299
}

0 commit comments

Comments
 (0)