forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.3: Fix freeing of incompletely initialized closures
- Loading branch information
Showing
3 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
GH-12073: Freeing of non-ZMM pointer of incompletely allocated closure | ||
--SKIPIF-- | ||
<?php | ||
if (getenv("USE_ZEND_ALLOC") === "0" && getenv("USE_TRACKED_ALLOC") !== "1") { | ||
die("skip Zend MM disabled"); | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
function test() { | ||
$k = 1; | ||
return function () use ($k) { | ||
foo(); | ||
}; | ||
} | ||
|
||
ini_set('memory_limit', '2M'); | ||
|
||
$array = []; | ||
for ($i = 0; $i < 10_000; $i++) { | ||
$array[] = test(); | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters