com php-src: Fixed bug #70601 (Segfault in gc_remove_from _buffer()): NEWS ext/opcache/Optimizer/pass1_ 5.c ext/opcache/tests/bug70601.phpt

From: Date: Sun, 04 Oct 2015 02:38:56 +0000
Subject: com php-src: Fixed bug #70601 (Segfault in gc_remove_from _buffer()): NEWS ext/opcache/Optimizer/pass1_ 5.c ext/opcache/tests/bug70601.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89281@lists.php.net to get a copy of this message
Commit: c147d90dbfcc4f9fd494215b7e5740e497d818c1 Author: Xinchen Hui <laruence@gmail.com> Sat, 3 Oct 2015 19:38:56 -0700 Parents: 83bef0ef83f645a6b84ba77b7c69ecdbad68f0a1 Branches: PHP-5.6 PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c147d90dbfcc4f9fd494215b7e5740e497d818c1 Log: Fixed bug #70601 (Segfault in gc_remove_from_buffer()) Bugs: https://bugs.php.net/70601 Changed paths: M NEWS M ext/opcache/Optimizer/pass1_5.c A ext/opcache/tests/bug70601.phpt Diff: diff --git a/NEWS b/NEWS index 7f5c7a4..4adadb2 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,9 @@ PHP NEWS (Andrey) . Fixed bug #70572 segfault in mysqlnd_connect.. (Andrey, Remi) +- Opcache: + . Fixed bug #70601 (Segfault in gc_remove_from_buffer()). (Laruence) + 01 Oct 2015, PHP 5.6.14 - Core: diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 4ed3dd4..1302e4b 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -314,9 +314,11 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { ZEND_IS_CONSTANT_TYPE(Z_TYPE(t))) { break; } - } else { + } else if (Z_TYPE_PP(c) <= IS_BOOL || Z_TYPE_PP(c) == IS_STRING) { t = **c; zval_copy_ctor(&t); + } else { + break; } if (ZEND_OP1_TYPE(opline) == IS_CONST) { diff --git a/ext/opcache/tests/bug70601.phpt b/ext/opcache/tests/bug70601.phpt new file mode 100644 index 0000000..55b1d7e --- /dev/null +++ b/ext/opcache/tests/bug70601.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #70601 (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 +const REPLACEMENTS_PASS_1 = [ "\x00" => "" ]; +class a { + const REPLACEMENTS_PASS_1 = [ "\x01" => "" ]; + public function __construct() { + echo strtr("Ok", REPLACEMENTS_PASS_1); + echo strtr("ay", self::REPLACEMENTS_PASS_1); + } +} + +new a(); +?> +--EXPECT-- +Okay

« previous php.cvs (#89281) next »