]> granicus.if.org Git - php/commitdiff
Prevent optimization of huge functions.
authorDmitry Stogov <dmitry@zend.com>
Fri, 16 Sep 2016 11:03:05 +0000 (14:03 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 16 Sep 2016 11:03:05 +0000 (14:03 +0300)
ext/opcache/Optimizer/zend_ssa.c

index b61a8dafa7ed017fee035df3d56658c3d7ba558b..d4cb20e3e3414d535143e2cd7e9d2453430b79e7 100644 (file)
@@ -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) {