com php-src: Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer): NEWS Zend/zend_compile .c ext/opcache/tests/bug70632.phpt
| From: | Xinchen Hui | Date: | Sun, 04 Oct 2015 03:33:24 +0000 |
| Subject: | com php-src: Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer): NEWS Zend/zend_compile .c ext/opcache/tests/bug70632.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89280@lists.php.net to get a copy of this message | ||
Commit: 2fb8bb1157958465a8b12c1a41015b907787c17a
Author: Xinchen Hui <laruence@gmail.com> Sat, 3 Oct 2015 20:33:24 -0700
Parents: 6876112c89e6dc4434e64a78084ca3bb118c98bd
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2fb8bb1157958465a8b12c1a41015b907787c17a
Log:
Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer)
Bugs:
https://bugs.php.net/70632
Changed paths:
M NEWS
M Zend/zend_compile.c
A ext/opcache/tests/bug70632.phpt
Diff:
diff --git a/NEWS b/NEWS
index 79ca987..d8d0354 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ PHP NEWS
. Fixed bug #70572 segfault in mysqlnd_connect. (Andrey, Remi)
- Opcache:
+ . Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer).
+ (Laruence)
. Fixed bug #70631 (Another Segfault in gc_remove_from_buffer()). (Laruence)
. Fixed bug #70601 (Segfault in gc_remove_from_buffer()). (Laruence)
diff --git a/Zend/zend_compile..c b/Zend/zend_compile.c
index 0bfb770..5ff1b04 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3472,10 +3472,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /*
{{
if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type !=
IS_UNUSED) {
zval *zv, zv_copy;
int use_copy;
- ALLOC_ZVAL(zv);
- *zv = *precv->op2.zv;
- zval_copy_ctor(zv);
- INIT_PZVAL(zv);
+ zv = precv->op2.zv;
if ((Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN_P(zv));
memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
@@ -3517,7 +3514,6 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /*
{{
zval_dtor(&zv_copy);
}
}
- zval_ptr_dtor(&zv);
}
} else {
memcpy(offset, "NULL", 4);
diff --git a/ext/opcache/tests/bug70632.phpt b/ext/opcache/tests/bug70632.phpt
new file mode 100644
index 0000000..4cdb5d8
--- /dev/null
+++ b/ext/opcache/tests/bug70632.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #70632 (Third one of segfault in gc_remove_from_buffer)
+--INI--
+opcache.enable=1
+opcache..enable_cli=1
+opcache.protect_memory=1
+--SKIPIF--
+<?php if (!extension_loaded('Zend OPcache')) die("skip"); ?>
+--FILE--
+<?php
+
+class A {
+ public function test($a = array("okey")) {
+ }
+}
+
+
+eval ("class B extends A { public function test() {} }");
+?>
+--EXPECTF--
+Strict Standards: Declaration of B::test() should be compatible with A::test($a = Array) in
%sbug70632.php(%d) : eval()'d code on line %d