Re: com php-src: Fix bug #73654: NEWS ext/opcache/Optimizer/zend_optimizer.c ext/opcache/tests/bug73654.phpt
| From: | Dmitry Stogov | Date: | Wed, 07 Dec 2016 06:10:11 +0000 |
| Subject: | Re: com php-src: Fix bug #73654: NEWS ext/opcache/Optimizer/zend_optimizer.c ext/opcache/tests/bug73654.phpt | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-96238@lists.php.net to get a copy of this message | ||
Hi Nikita,
The fix is wrong or incomplete. It keeps VERIFY_RETURN_TYPE instruction that uses uninitialized TMP.
$ sapi/cli/php -d opcache.opt_debug_level=0x20000 ../ext/opcache/tests/bug73654.phpt
xyz: ; (lines=2, args=0, vars=0, tmps=1)
; (after optimizer)
; /home/dmitry/php/php-master/ext/opcache/tests/bug73654.phpt:11-13
L0: VERIFY_RETURN_TYPE T0
L1: RETURN string("xyz")
$ USE_ZEND_ALLOC=0 valgrind sapi/cli/php ../ext/opcache/tests/bug73654.phpt
==19018== Conditional jump or move depends on uninitialised value(s)
==19018== at 0x866CE38: _get_zval_ptr_tmp (zend_execute.c:192)
==19018== by 0x868B867: ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UNUSED_HANDLER (zend_vm_execute.h:14373)
==19018== by 0x8672D44: execute_ex (zend_vm_execute.h:429)
==19018== by 0x8672DF9: zend_execute (zend_vm_execute.h:474)
==19018== by 0x8626F9D: zend_execute_scripts (zend.c:1474)
==19018== by 0x85B5AE6: php_execute_script (main.c:2531)
==19018== by 0x86E2560: do_cli (php_cli.c:994)
==19018== by 0x86E31CC: main (php_cli.c:1387)
Thanks. Dmitry.
________________________________
From: Nikita Popov <nikic@php.net>
Sent: Monday, December 5, 2016 10:41:14 PM
To: php-cvs@lists.php.net
Subject: [PHP-CVS] com php-src: Fix bug #73654: NEWS ext/opcache/Optimizer/zend_optimizer.c
ext/opcache/tests/bug73654.phpt
Commit: 3b79f8f408ab090825bc15656e517746fdc43db9
Author: Nikita Popov <nikic@php.net> Mon, 5 Dec 2016 20:39:45 +0100
Parents: 2f0e61f4b7904956825e86211e21ab4bf503fa0a
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3b79f8f408ab090825bc15656e517746fdc43db9
Log:
Fix bug #73654
Bugs:
https://bugs.php.net/73654
Changed paths:
M NEWS
M ext/opcache/Optimizer/zend_optimizer.c
A ext/opcache/tests/bug73654.phpt
Diff:
diff --git a/NEWS b/NEWS
index f51e6b0..2810fe0 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,8 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2017, PHP 7.1.1
-
+- Opcache:
+ . Fixed bug #73654 (Segmentation fault in zend_call_function). (Nikita)
01 Dec 2016, PHP 7.1.0
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index c88821e..b6506e0 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -200,6 +200,11 @@ int zend_optimizer_update_op1_const(zend_op_array *op_array,
case ZEND_SEND_VAR_NO_REF_EX:
zval_ptr_dtor(val);
return 0;
+ case ZEND_VERIFY_RETURN_TYPE:
+ /* This would require a non-local change.
+ * zend_optimizer_replace_by_const() supports this. */
+ zval_ptr_dtor(val);
+ return 0;
case ZEND_CONCAT:
case ZEND_FAST_CONCAT:
case ZEND_FETCH_R:
diff --git a/ext/opcache/tests/bug73654.phpt b/ext/opcache/tests/bug73654.phpt
new file mode 100644
index 0000000..164e108
--- /dev/null
+++ b/ext/opcache/tests/bug73654.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #73654: Segmentation fault in zend_call_function
+--FILE--
+<?php
+echo xyz();
+
+function x () : string {
+ return 'x';
+}
+
+function xyz() : string {
+ return x().'yz';
+}
+
+?>
+--EXPECT--
+xyz
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php