-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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 GH-11078: PHP Fatal error triggers pointer being freed was not allocated and malloc: double free for ptr errors
- Loading branch information
Showing
5 changed files
with
84 additions
and
2 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,34 @@ | ||
--TEST-- | ||
GH-11078 (PHP Fatal error triggers pointer being freed was not allocated and malloc: double free for ptr errors) | ||
--EXTENSIONS-- | ||
zend_test | ||
--SKIPIF-- | ||
<?php | ||
if (getenv('USE_ZEND_ALLOC') === '0') die('skip Zend MM disabled'); | ||
if (PHP_OS_FAMILY === 'Windows') die('skip Windows does not support generic stream casting'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
const MEM = 32 * 1024 * 1024; | ||
ini_set('memory_limit', MEM); | ||
|
||
class CrashingFifo { | ||
public $context; | ||
|
||
function stream_open($path, $mode, $options, &$opened_path): bool { | ||
return true; | ||
} | ||
|
||
function stream_read(int $count): false|string|null { | ||
return str_repeat('x', MEM); | ||
} | ||
} | ||
|
||
stream_register_wrapper('fifo', CrashingFifo::class); | ||
$readStream = fopen('fifo://1', 'r'); | ||
zend_test_cast_fread($readStream); | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Allowed memory size of %d bytes exhausted %s |
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