com php-src: Prevent optimization of huge functions.: ext/opcache/Optimizer/zend_ssa.c

From: Date: Fri, 16 Sep 2016 11:03:05 +0000
Subject: com php-src: Prevent optimization of huge functions.: ext/opcache/Optimizer/zend_ssa.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94567@lists.php.net to get a copy of this message
Commit: 846441ab4b670de77298803d9647d1f043e91ceb Author: Dmitry Stogov <dmitry@zend.com> Fri, 16 Sep 2016 14:03:05 +0300 Parents: a8a123e36c4fe1f5d68ff10ee7745432a9ceb63b Branches: PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=846441ab4b670de77298803d9647d1f043e91ceb Log: Prevent optimization of huge functions. Changed paths: M ext/opcache/Optimizer/zend_ssa.c Diff: diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index b61a8da..d4cb20e 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -847,6 +847,11 @@ int zend_build_ssa(zend_arena **arena, const zend_script *script, const zend_op_ ALLOCA_FLAG(dfg_use_heap) ALLOCA_FLAG(var_use_heap) + if ((blocks_count * (op_array->last_var + op_array->T)) > 4 * 1024 * 1024) { + /* Don't buld SSA for very big functions */ + return FAILURE; + } + ssa->rt_constants = (build_flags & ZEND_RT_CONSTANTS); ssa_blocks = zend_arena_calloc(arena, blocks_count, sizeof(zend_ssa_block)); if (!ssa_blocks) {

« previous php.cvs (#94567) next »