com php-src: Fixed bug #71843 (null ptr deref ZEND_RETURN_S PEC_CONST_HANDLER): NEWS ext/opcache/Optimizer/bloc k_pass.c
ext/opcache/tests/bug71843.phpt
| From: | Xinchen Hui | Date: | Thu, 17 Mar 2016 11:54:19 +0000 |
| Subject: | com php-src: Fixed bug #71843 (null ptr deref ZEND_RETURN_S PEC_CONST_HANDLER): NEWS ext/opcache/Optimizer/bloc k_pass.c ext/opcache/tests/bug71843.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91396@lists.php.net to get a copy of this message | ||
Commit: 8e2f658f49c76c9feed894414fb3a8edb27beef0
Author: Xinchen Hui <laruence@gmail.com> Thu, 17 Mar 2016 19:06:50 +0800
Parents: 6d4aec029a06140eac8f57e8b3daa06aee43e145
Branches: PHP-7.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8e2f658f49c76c9feed894414fb3a8edb27beef0
Log:
Fixed bug #71843 (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER)
Bugs:
https://bugs.php.net/71843
Changed paths:
M NEWS
M ext/opcache/Optimizer/block_pass.c
A ext/opcache/tests/bug71843.phpt
Diff:
diff --git a/NEWS b/NEWS
index 5ffad76..9a200f9 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,10 @@ PHP NEWS
- Core:
. Fixed bug #71841 (EG(error_zval) is not handled well). (Laruence)
+- Opcache:
+ . Fixed bug #71843 (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER).
+ (Laruence)
+
- Standard:
. Fixed bug #71840 (Unserialize accepts wrongly data). (Ryat, Laruence)
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index c146d0c..bf3f144 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -716,8 +716,11 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array
*op_array,
if (src->opcode == ZEND_BOOL) {
if (ZEND_OP1_TYPE(src) == IS_CONST) {
literal_dtor(&ZEND_OP1_LITERAL(src));
+ } else if (ZEND_OP1_TYPE(src) == IS_TMP_VAR) {
+ src->opcode = ZEND_FREE;
+ } else {
+ MAKE_NOP(src);
}
- MAKE_NOP(src);
MAKE_NOP(opline);
}
}
diff --git a/ext/opcache/tests/bug71843.phpt b/ext/opcache/tests/bug71843.phpt
new file mode 100644
index 0000000..7fcf32c
--- /dev/null
+++ b/ext/opcache/tests/bug71843.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #71843 (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER (zend_vm_execute.h:3479))
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=0xFFFFBFFF
+--SKIPIF--
+<?php if (!extension_loaded('Zend OPcache')) die("skip"); ?>
+--FILE--
+<?
+0 & ~E & ~R;
+6 && ~See
+?>
+okey
+--EXPECTF--
+Notice: Use of undefined constant E - assumed 'E' in %sbug71843.php on line %d
+
+Notice: Use of undefined constant R - assumed 'R' in %sbug71843.php on line %d
+
+Notice: Use of undefined constant See - assumed 'See' in %sbug71843.php on line %d
+okey