com php-src: Fixed bug #78658: NEWS Zend/tests/bug78658.phpt Zend/zend_closures.c

From: Date: Wed, 09 Oct 2019 15:00:27 +0000
Subject: com php-src: Fixed bug #78658: NEWS Zend/tests/bug78658.phpt Zend/zend_closures.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108832@lists.php.net to get a copy of this message
Commit: 6fd6ad8f53f68154fa23de25f400d89ae29d54d0 Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 9 Oct 2019 16:59:38 +0200 Parents: cbf589b17c45c5b225cbd190dbe09fa278a57e60 Branches: PHP-7.3 PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6fd6ad8f53f68154fa23de25f400d89ae29d54d0 Log: Fixed bug #78658 Bugs: https://bugs.php.net/78658 Changed paths: M NEWS A Zend/tests/bug78658.phpt M Zend/zend_closures.c Diff: diff --git a/NEWS b/NEWS index b7d193ab581..e96d88f4c1c 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 7.3.12 +- Core: + . Fixed bug #78658 (Memory corruption using Closure::bindTo). (Nikita) + - Iconv: . Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas, cmb). diff --git a/Zend/tests/bug78658.phpt b/Zend/tests/bug78658.phpt new file mode 100644 index 00000000000..3445b98b097 --- /dev/null +++ b/Zend/tests/bug78658.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #78658: Memory corruption using Closure::bindTo() +--FILE-- +<?php + +$c = function(){}; + +$scope = "AAAA"; +$scope = "{$scope}BBBB"; +$c->bindTo(new stdClass, $scope); + +?> +--EXPECTF-- +Warning: Class 'AAAABBBB' not found in %s on line %d diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index ac638262624..fce69f12ff9 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -200,7 +200,7 @@ ZEND_METHOD(Closure, bind) ce = closure->func.common.scope; } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) { zend_error(E_WARNING, "Class '%s' not found", ZSTR_VAL(class_name)); - zend_string_release_ex(class_name, 0); + zend_tmp_string_release(tmp_class_name); RETURN_NULL(); } zend_tmp_string_release(tmp_class_name);

« previous php.cvs (#108832) next »