com php-src: Fixed bug #69025 (Invalid read of size 4 when calling __callStatic): Zend/tests/bug69025.phpt Zend/zend_object_handlers.c
Zend/zend_vm_def.h Zend/zend_vm_execute.h

From: Date: Wed, 11 Feb 2015 14:41:21 +0000
Subject: com php-src: Fixed bug #69025 (Invalid read of size 4 when calling __callStatic): Zend/tests/bug69025.phpt Zend/zend_object_handlers.c
Zend/zend_vm_def.h Zend/zend_vm_execute.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84812@lists.php.net to get a copy of this message
Commit: 35aea97e42ebad10437688472fa03c6768ca6ea3 Author: Dmitry Stogov <dmitry@zend.com> Wed, 11 Feb 2015 17:41:21 +0300 Parents: 52f5cb914eaf1a6474cb3e9c807d131b7c34b5c5 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=35aea97e42ebad10437688472fa03c6768ca6ea3 Log: Fixed bug #69025 (Invalid read of size 4 when calling __callStatic) Bugs: https://bugs.php.net/69025 Changed paths: A Zend/tests/bug69025.phpt M Zend/zend_object_handlers.c M Zend/zend_vm_def.h M Zend/zend_vm_execute.h Diff: diff --git a/Zend/tests/bug69025.phpt b/Zend/tests/bug69025.phpt new file mode 100644 index 0000000..389c09f --- /dev/null +++ b/Zend/tests/bug69025.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #69025 (Invalid read of size 4 when calling __callStatic) +--FILE-- +<?php +class A { + public static function __callStatic($method, $args) + { + } +} + +A::init(); +?> +OK +--EXPECT-- +OK diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 7a94a3d..9a376aa 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers..c @@ -936,6 +936,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ /* destruct the function also, then - we have allocated it in get_method */ efree_size(func, sizeof(zend_internal_function)); + execute_data->func = NULL; } /* }}} */ @@ -1156,6 +1157,7 @@ ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ /* destruct the function also, then - we have allocated it in get_method */ efree_size(func, sizeof(zend_internal_function)); + execute_data->func = NULL; } /* }}} */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 8a1bda8..f437f43 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2871,14 +2871,16 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY) } else { zend_execute_internal(call, ret); } + + ZEND_ASSERT( + !call->func || + !(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) || + zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var))); + EG(current_execute_data) = call->prev_execute_data; zend_vm_stack_free_args(call); zend_vm_stack_free_call_frame(call); - ZEND_ASSERT( - !(fbc->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) || - zend_verify_internal_return_type(fbc, EX_VAR(opline->result.var))); - if (!RETURN_VALUE_USED(opline)) { zval_ptr_dtor(EX_VAR(opline->result.var)); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 19e1a74..3e32191 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -597,14 +597,16 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zend_execute_internal(call, ret); } + + ZEND_ASSERT( + !call->func || + !(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) || + zend_verify_internal_return_type(call->func, EX_VAR(opline->result.var))); + EG(current_execute_data) = call->prev_execute_data; zend_vm_stack_free_args(call); zend_vm_stack_free_call_frame(call); - ZEND_ASSERT( - !(fbc->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) || - zend_verify_internal_return_type(fbc, EX_VAR(opline->result.var))); - if (!RETURN_VALUE_USED(opline)) { zval_ptr_dtor(EX_VAR(opline->result.var)); }

« previous php.cvs (#84812) next »