com php-src: Fixed bug #70237 (Empty while and do-while segmentation fault with opcode on CLI enabled).: NEWS ext/opcache/Optimizer/block _pass.c
ext/opcache/tests/bug70237.phpt
| From: | Xinchen Hui | Date: | Tue, 11 Aug 2015 13:01:56 +0000 |
| Subject: | com php-src: Fixed bug #70237 (Empty while and do-while segmentation fault with opcode on CLI enabled).: NEWS ext/opcache/Optimizer/block _pass.c ext/opcache/tests/bug70237.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88462@lists.php.net to get a copy of this message | ||
Commit: 79cd9a18b505e8d77d16abe6ef146d4b4ff02ed9
Author: Xinchen Hui <laruence@php.net> Tue, 11 Aug 2015 21:01:56 +0800
Parents: 42ef2b500be2d9d3d8ebf77f8c701c39c150aa39
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=79cd9a18b505e8d77d16abe6ef146d4b4ff02ed9
Log:
Fixed bug #70237 (Empty while and do-while segmentation fault with opcode on CLI enabled).
Bugs:
https://bugs.php.net/70237
Changed paths:
M NEWS
M ext/opcache/Optimizer/block_pass.c
A ext/opcache/tests/bug70237.phpt
Diff:
diff --git a/NEWS b/NEWS
index 3f339fc..2a16be2 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ PHP NEWS
. Fixed bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE).
(wusuopu, cmb)
+- Opcache:
+ . Fixed bug #70237 (Empty while and do-while segmentation fault with opcode
+ on CLI enabled). (Dmitry, Laruence)
+
- Standard:
. Fixed bug #70052 (getimagesize() fails for very large and very small WBMP).
(cmb)
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 8d33105..c146d0c 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -367,6 +367,10 @@ static inline void del_source(zend_code_block *from, zend_code_block *to)
return;
}
+ if (from == to) {
+ return;
+ }
+
while (*cs) {
if ((*cs)->from == from) {
DEL_SOURCE(cs);
diff --git a/ext/opcache/tests/bug70237.phpt b/ext/opcache/tests/bug70237.phpt
new file mode 100644
index 0000000..6bd0318
--- /dev/null
+++ b/ext/opcache/tests/bug70237.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #70237 (Empty while and do-while segmentation fault with opcode on CLI enabled)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+
+function neverUsed() {
+ $bool = false;
+ while ($bool) { };
+ //do { } while ($bool);
+}
+?>
+okey
+--EXPECT--
+okey