forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix uouv on oom on object allocation
Initialize object.handlers to std_object_handlers on zend_objects_new. This avoids a use-after-free for objects using custom handlers that are installed after allocation, accessing the handlers on shutdown when they haven't been set yet. Fixes phpGH-11734
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
GH-11734: Use-of-uninitialized-value when OOM on object allocation | ||
--INI-- | ||
memory_limit=2M | ||
--SKIPIF-- | ||
<?php | ||
$zend_mm_enabled = getenv("USE_ZEND_ALLOC"); | ||
if ($zend_mm_enabled === "0") { | ||
die("skip Zend MM disabled"); | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
$objs = []; | ||
while (true) { | ||
$objs[] = new SplPriorityQueue; | ||
} | ||
?> | ||
--EXPECTF-- | ||
Fatal error: Allowed memory size of %d bytes exhausted at %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