dmitry          Tue Nov 20 09:51:44 2007 UTC

  Modified files:              
    /ZendEngine2        zend_execute.c zend_execute_API.c zend_globals.h 
                        zend_object_handlers.c zend_vm_def.h zend_vm_execute.h 
                        zend_vm_execute.skl 
    /php-src/ext/com_dotnet     com_com.c com_handlers.c 
    /php-src/ext/spl    php_spl.c 
  Log:
  Fixed bug #43136 (possible crash on script execution timeout. The 
EG(function_state_ptr) is completely removed, 
EG(current_execute_data)->function_state must be used instead)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.771&r2=1.772&diff_format=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.771 ZendEngine2/zend_execute.c:1.772
--- ZendEngine2/zend_execute.c:1.771    Sun Oct  7 05:15:02 2007
+++ ZendEngine2/zend_execute.c  Tue Nov 20 09:51:43 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute.c,v 1.771 2007/10/07 05:15:02 davidw Exp $ */
+/* $Id: zend_execute.c,v 1.772 2007/11/20 09:51:43 dmitry Exp $ */
 
 #define ZEND_INTENSIVE_DEBUGGING 0
 
@@ -1445,6 +1445,7 @@
        } \
        EG(in_execution) = EX(original_in_execution); \
        EG(current_execute_data) = EX(prev_execute_data); \
+       EG(opline_ptr) = NULL; \
        ZEND_VM_RETURN()
 
 #include "zend_vm_execute.h"
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.423&r2=1.424&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.423 
ZendEngine2/zend_execute_API.c:1.424
--- ZendEngine2/zend_execute_API.c:1.423        Fri Nov  2 10:11:59 2007
+++ ZendEngine2/zend_execute_API.c      Tue Nov 20 09:51:43 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.423 2007/11/02 10:11:59 dmitry Exp $ */
+/* $Id: zend_execute_API.c,v 1.424 2007/11/20 09:51:43 dmitry Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -362,11 +362,11 @@
                }
                return EMPTY_ZSTR;
        }
-       switch (EG(function_state_ptr)->function->type) {
+       switch (EG(current_execute_data)->function_state.function->type) {
                case ZEND_USER_FUNCTION:
                case ZEND_INTERNAL_FUNCTION:
                {
-                       zend_class_entry *ce = 
EG(function_state_ptr)->function->common.scope;
+                       zend_class_entry *ce = 
EG(current_execute_data)->function_state.function->common.scope;
 
                        if (space) {
                                *space = ce ? "::" : "";
@@ -389,9 +389,9 @@
        if (!zend_is_executing(TSRMLS_C)) {
                return NULL_ZSTR;
        }
-       switch (EG(function_state_ptr)->function->type) {
+       switch (EG(current_execute_data)->function_state.function->type) {
                case ZEND_USER_FUNCTION: {
-                               zstr function_name = ((zend_op_array *) 
EG(function_state_ptr)->function)->function_name;
+                               zstr function_name = ((zend_op_array 
*)EG(current_execute_data)->function_state.function)->function_name;
 
                                if (function_name.v) {
                                        return function_name;
@@ -404,7 +404,7 @@
                        }
                        break;
                case ZEND_INTERNAL_FUNCTION:
-                       return ((zend_internal_function *) 
EG(function_state_ptr)->function)->function_name;
+                       return ((zend_internal_function 
*)EG(current_execute_data)->function_state.function)->function_name;
                        break;
                default:
                        return NULL_ZSTR;
@@ -655,7 +655,6 @@
        zend_uint i;
        zval **original_return_value;
        HashTable *calling_symbol_table;
-       zend_function_state *original_function_state_ptr;
        zend_op_array *original_op_array;
        zend_op **original_opline_ptr;
        zend_class_entry *current_scope;
@@ -1045,9 +1044,6 @@
 
        zend_ptr_stack_2_push(&EG(argument_stack), (void *) (zend_uintptr_t) 
fci->param_count, NULL);
 
-       original_function_state_ptr = EG(function_state_ptr);
-       EG(function_state_ptr) = &EX(function_state);
-
        current_scope = EG(scope);
        EG(scope) = calling_scope;
 
@@ -1136,7 +1132,6 @@
                zval_ptr_dtor(&method_name);
                zval_ptr_dtor(&params_array);
        }
-       EG(function_state_ptr) = original_function_state_ptr;
 
        if (EG(This)) {
                zval_ptr_dtor(&EG(This));
@@ -1316,7 +1311,6 @@
        zval pv;
        zend_op_array *new_op_array;
        zend_op_array *original_active_op_array = EG(active_op_array);
-       zend_function_state *original_function_state_ptr = 
EG(function_state_ptr);
        zend_uchar original_handle_op_arrays;
        int retval;
 
@@ -1382,7 +1376,6 @@
                EG(no_extensions)=0;
                EG(opline_ptr) = original_opline_ptr;
                EG(active_op_array) = original_active_op_array;
-               EG(function_state_ptr) = original_function_state_ptr;
                destroy_op_array(new_op_array TSRMLS_CC);
                efree(new_op_array);
                EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_globals.h?r1=1.170&r2=1.171&diff_format=u
Index: ZendEngine2/zend_globals.h
diff -u ZendEngine2/zend_globals.h:1.170 ZendEngine2/zend_globals.h:1.171
--- ZendEngine2/zend_globals.h:1.170    Fri Sep 28 02:04:28 2007
+++ ZendEngine2/zend_globals.h  Tue Nov 20 09:51:43 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_globals.h,v 1.170 2007/09/28 02:04:28 jani Exp $ */
+/* $Id: zend_globals.h,v 1.171 2007/11/20 09:51:43 dmitry Exp $ */
 
 #ifndef ZEND_GLOBALS_H
 #define ZEND_GLOBALS_H
@@ -157,7 +157,6 @@
        zval error_zval;
        zval *error_zval_ptr;
 
-       zend_function_state *function_state_ptr;
        zend_ptr_stack arg_types_stack;
 
        /* symbol table cache */
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.192&r2=1.193&diff_format=u
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.192 
ZendEngine2/zend_object_handlers.c:1.193
--- ZendEngine2/zend_object_handlers.c:1.192    Sat Nov 17 21:51:40 2007
+++ ZendEngine2/zend_object_handlers.c  Tue Nov 20 09:51:43 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_object_handlers.c,v 1.192 2007/11/17 21:51:40 pollita Exp $ */
+/* $Id: zend_object_handlers.c,v 1.193 2007/11/20 09:51:43 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_globals.h"
@@ -655,7 +655,7 @@
 
 ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
 {
-       zend_internal_function *func = (zend_internal_function 
*)EG(function_state_ptr)->function;
+       zend_internal_function *func = (zend_internal_function 
*)EG(current_execute_data)->function_state.function;
        zval *method_name_ptr, *method_args_ptr;
        zval *method_result_ptr = NULL;
        zend_class_entry *ce = Z_OBJCE_P(this_ptr);
@@ -860,7 +860,7 @@
 
 ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* 
{{{ */
 {
-       zend_internal_function *func = (zend_internal_function 
*)EG(function_state_ptr)->function;
+       zend_internal_function *func = (zend_internal_function 
*)EG(current_execute_data)->function_state.function;
        zval *method_name_ptr, *method_args_ptr;
        zval *method_result_ptr = NULL;
        zend_class_entry *ce = EG(scope);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.196&r2=1.197&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.196 ZendEngine2/zend_vm_def.h:1.197
--- ZendEngine2/zend_vm_def.h:1.196     Tue Nov  6 14:56:32 2007
+++ ZendEngine2/zend_vm_def.h   Tue Nov 20 09:51:43 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_vm_def.h,v 1.196 2007/11/06 14:56:32 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.197 2007/11/20 09:51:43 dmitry Exp $ */
 
 /* If you change this file, please regenerate the zend_vm_execute.h and
  * zend_vm_opcodes.h files by running:
@@ -2088,8 +2088,6 @@
                        zend_execute_internal(EXECUTE_DATA, return_value_used 
TSRMLS_CC);
                }
 
-               EG(current_execute_data) = EXECUTE_DATA;
-
 /*     We shouldn't fix bad extensions here,
     because it can break proper ones (Bug #34045)
                if (!EX(function_state).function->common.return_reference) {
@@ -2168,7 +2166,6 @@
        }
 
        EX(function_state).function = (zend_function *) EX(op_array);
-       EG(function_state_ptr) = &EX(function_state);
 
        if (EG(This)) {
                if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) {
@@ -3126,7 +3123,6 @@
 
                EG(opline_ptr) = &EX(opline);
                EG(active_op_array) = EX(op_array);
-               EG(function_state_ptr) = &EX(function_state);
                destroy_op_array(new_op_array TSRMLS_CC);
                efree(new_op_array);
                if (EG(exception)) {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.200&r2=1.201&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.200 ZendEngine2/zend_vm_execute.h:1.201
--- ZendEngine2/zend_vm_execute.h:1.200 Tue Nov  6 14:56:32 2007
+++ ZendEngine2/zend_vm_execute.h       Tue Nov 20 09:51:43 2007
@@ -75,7 +75,6 @@
        EG(opline_ptr) = &EX(opline);
 
        EX(function_state).function = (zend_function *) op_array;
-       EG(function_state_ptr) = &EX(function_state);
 
        while (1) {
 #ifdef ZEND_WIN32
@@ -85,7 +84,7 @@
 #endif
 
                if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) {
-      return;
+                       return;
                }
 
        }
@@ -204,8 +203,6 @@
                        zend_execute_internal(execute_data, return_value_used 
TSRMLS_CC);
                }
 
-               EG(current_execute_data) = execute_data;
-
 /*     We shouldn't fix bad extensions here,
     because it can break proper ones (Bug #34045)
                if (!EX(function_state).function->common.return_reference) {
@@ -284,7 +281,6 @@
        }
 
        EX(function_state).function = (zend_function *) EX(op_array);
-       EG(function_state_ptr) = &EX(function_state);
 
        if (EG(This)) {
                if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) {
@@ -1907,7 +1903,6 @@
 
                EG(opline_ptr) = &EX(opline);
                EG(active_op_array) = EX(op_array);
-               EG(function_state_ptr) = &EX(function_state);
                destroy_op_array(new_op_array TSRMLS_CC);
                efree(new_op_array);
                if (EG(exception)) {
@@ -5115,7 +5110,6 @@
 
                EG(opline_ptr) = &EX(opline);
                EG(active_op_array) = EX(op_array);
-               EG(function_state_ptr) = &EX(function_state);
                destroy_op_array(new_op_array TSRMLS_CC);
                efree(new_op_array);
                if (EG(exception)) {
@@ -8411,7 +8405,6 @@
 
                EG(opline_ptr) = &EX(opline);
                EG(active_op_array) = EX(op_array);
-               EG(function_state_ptr) = &EX(function_state);
                destroy_op_array(new_op_array TSRMLS_CC);
                efree(new_op_array);
                if (EG(exception)) {
@@ -21935,7 +21928,6 @@
 
                EG(opline_ptr) = &EX(opline);
                EG(active_op_array) = EX(op_array);
-               EG(function_state_ptr) = &EX(function_state);
                destroy_op_array(new_op_array TSRMLS_CC);
                efree(new_op_array);
                if (EG(exception)) {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.skl?r1=1.9&r2=1.10&diff_format=u
Index: ZendEngine2/zend_vm_execute.skl
diff -u ZendEngine2/zend_vm_execute.skl:1.9 ZendEngine2/zend_vm_execute.skl:1.10
--- ZendEngine2/zend_vm_execute.skl:1.9 Sun Oct  7 05:15:03 2007
+++ ZendEngine2/zend_vm_execute.skl     Tue Nov 20 09:51:43 2007
@@ -46,7 +46,6 @@
        EG(opline_ptr) = &EX(opline);
 
        EX(function_state).function = (zend_function *) op_array;
-       EG(function_state_ptr) = &EX(function_state);
 
        while (1) {
     {%ZEND_VM_CONTINUE_LABEL%}
@@ -57,7 +56,7 @@
 #endif
 
                {%ZEND_VM_DISPATCH%} {
-      {%INTERNAL_EXECUTOR%}
+                       {%INTERNAL_EXECUTOR%}
                }
 
        }
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_com.c?r1=1.23&r2=1.24&diff_format=u
Index: php-src/ext/com_dotnet/com_com.c
diff -u php-src/ext/com_dotnet/com_com.c:1.23 
php-src/ext/com_dotnet/com_com.c:1.24
--- php-src/ext/com_dotnet/com_com.c:1.23       Mon Apr  9 15:31:54 2007
+++ php-src/ext/com_dotnet/com_com.c    Tue Nov 20 09:51:44 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_com.c,v 1.23 2007/04/09 15:31:54 dmitry Exp $ */
+/* $Id: com_com.c,v 1.24 2007/11/20 09:51:44 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -469,7 +469,7 @@
        HRESULT hr;
        VARIANT *vargs = NULL, *byref_vals = NULL;
        int i, byref_count = 0, j;
-       zend_internal_function *f = 
(zend_internal_function*)EG(function_state_ptr)->function;
+       zend_internal_function *f = 
(zend_internal_function*)EG(current_execute_data)->function_state.function;
 
        /* assumption: that the active function (f) is the function we 
generated for the engine */
        if (!f || f->arg_info == NULL) {
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_handlers.c?r1=1.44&r2=1.45&diff_format=u
Index: php-src/ext/com_dotnet/com_handlers.c
diff -u php-src/ext/com_dotnet/com_handlers.c:1.44 
php-src/ext/com_dotnet/com_handlers.c:1.45
--- php-src/ext/com_dotnet/com_handlers.c:1.44  Sun Oct  7 05:15:03 2007
+++ php-src/ext/com_dotnet/com_handlers.c       Tue Nov 20 09:51:44 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: com_handlers.c,v 1.44 2007/10/07 05:15:03 davidw Exp $ */
+/* $Id: com_handlers.c,v 1.45 2007/11/20 09:51:44 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -255,7 +255,7 @@
 static PHP_FUNCTION(com_method_handler)
 {
        Z_OBJ_HANDLER_P(getThis(), call_method)(
-                       
((zend_internal_function*)EG(function_state_ptr)->function)->function_name,
+                       
((zend_internal_function*)EG(current_execute_data)->function_state.function)->function_name,
                        INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.117&r2=1.118&diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.117 php-src/ext/spl/php_spl.c:1.118
--- php-src/ext/spl/php_spl.c:1.117     Thu Nov  1 22:31:39 2007
+++ php-src/ext/spl/php_spl.c   Tue Nov 20 09:51:44 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_spl.c,v 1.117 2007/11/01 22:31:39 jani Exp $ */
+/* $Id: php_spl.c,v 1.118 2007/11/20 09:51:44 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -265,7 +265,6 @@
        zval **original_return_value = EG(return_value_ptr_ptr);
        zend_op **original_opline_ptr = EG(opline_ptr);
        zend_op_array *original_active_op_array = EG(active_op_array);
-       zend_function_state *original_function_state_ptr = 
EG(function_state_ptr);
        
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "x|x", 
&class_name, &class_name_len, &file_exts, &file_exts_len) == FAILURE) {
                RETURN_FALSE;
@@ -277,7 +276,6 @@
                EG(return_value_ptr_ptr) = original_return_value;
                EG(opline_ptr) = original_opline_ptr;
                EG(active_op_array) = original_active_op_array;
-               EG(function_state_ptr) = original_function_state_ptr;
                if (unicode) {
                        pos2.u = u_strchr(pos1.u, ',');
                        if (pos2.u) *pos2.u = '\0';
@@ -306,7 +304,6 @@
        EG(return_value_ptr_ptr) = original_return_value;
        EG(opline_ptr) = original_opline_ptr;
        EG(active_op_array) = original_active_op_array;
-       EG(function_state_ptr) = original_function_state_ptr;
 
        if (!found && !SPL_G(autoload_running)) {
                zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, 
"Class %v could not be loaded", class_name);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to