]> granicus.if.org Git - php/commitdiff
Fixed bug #70237 (Empty while and do-while segmentation fault with opcode on CLI...
authorXinchen Hui <laruence@php.net>
Tue, 11 Aug 2015 13:01:56 +0000 (21:01 +0800)
committerXinchen Hui <laruence@php.net>
Tue, 11 Aug 2015 13:01:56 +0000 (21:01 +0800)
NEWS
ext/opcache/Optimizer/block_pass.c
ext/opcache/tests/bug70237.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 3f339fc5cd392f5a8852f7f9810c60ce0cc53667..2a16be2ce7db9bcf7dfd8bca6783d813e968b745 100644 (file)
--- 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)
index 8d3310586673bb0ca0295bcb811b68941b4a42b9..c146d0cc8cbd7af95a71352ff19b7fa0de5d207a 100644 (file)
@@ -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 (file)
index 0000000..6bd0318
--- /dev/null
@@ -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