com php-src: Fixed bug #69212: NEWS Zend/tests/bug69212.phpt Zend/zend_vm_def.h Zend/zend_vm_execute.h

From: Date: Tue, 10 Mar 2015 17:17:56 +0000
Subject: com php-src: Fixed bug #69212: NEWS Zend/tests/bug69212.phpt Zend/zend_vm_def.h Zend/zend_vm_execute.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85448@lists.php.net to get a copy of this message
Commit: bc9f2fb8dfadc1dba4264695ded28f673c54dc75 Author: Nikita Popov <nikic@php.net> Tue, 10 Mar 2015 18:17:56 +0100 Parents: c814b3294ad72baad8d9da52dbef81dcafded451 Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bc9f2fb8dfadc1dba4264695ded28f673c54dc75 Log: Fixed bug #69212 Bugs: https://bugs.php.net/69212 Changed paths: M NEWS A Zend/tests/bug69212.phpt M Zend/zend_vm_def.h M Zend/zend_vm_execute..h Diff: diff --git a/NEWS b/NEWS index 826be4c..3a431bf 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ PHP NEWS . Fixed bug #67626 (User exceptions not properly handled in streams). (Julian) . Fixed bug #68917 (parse_url fails on some partial urls). (Wei Dai) + . Fixed bug #69212 (Leaking VIA_HANDLER func when exception thrown in + __call/... arg passing). (Nikita) - Filter: . Fixed bug #69202: (FILTER_FLAG_STRIP_BACKTICK ignored unless other diff --git a/Zend/tests/bug69212.phpt b/Zend/tests/bug69212.phpt new file mode 100644 index 0000000..801073e --- /dev/null +++ b/Zend/tests/bug69212.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #69212: Leaking VIA_HANDLER func when exception thrown in __call/... arg passing +--FILE-- +<?php + +class Test { + public static function __callStatic($method, $args) {} + public function __call($method, $args) {} +} + +function do_throw() { throw new Exception; } + +try { + Test::foo(do_throw()); +} catch (Exception $e) { + echo "Caught!\n"; +} +try { + (new Test)->bar(do_throw()); +} catch (Exception $e) { + echo "Caught!\n"; +} + +?> +--EXPECT-- +Caught! +Caught! diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 8954e69..66758d4 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5042,6 +5042,10 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } zval_ptr_dtor(&call->object); } + if (call->fbc->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) { + efree((char *) call->fbc->common.function_name); + efree(call->fbc); + } call--; } while (call >= EX(call_slots)); EX(call) = NULL; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute..h index c0b64b6..58ca552 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1022,6 +1022,10 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER } zval_ptr_dtor(&call->object); } + if (call->fbc->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) { + efree((char *) call->fbc->common.function_name); + efree(call->fbc); + } call--; } while (call >= EX(call_slots)); EX(call) = NULL;

« previous php.cvs (#85448) next »