[php-src] Issue #14687: Segmentation fault (access null pointer) in ext/spl/spl_directory.c

From: Date: Thu, 27 Jun 2024 13:28:34 +0000
Subject: [php-src] Issue #14687: Segmentation fault (access null pointer) in ext/spl/spl_directory.c
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247158@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14687 Author: YuanchengJiang ### Description The following code: ```php <?php $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip'; $phar = new Phar($fname); $script1_dataflow = $phar; class HasDestructor { public function __destruct() { var_dump($GLOBALS['s']); } } $s = new SplObjectStorage(); $s[$script1_dataflow] = new HasDestructor(); $script2_connect=$s; ``` Resulted in this output: ``` object(SplObjectStorage)#2 (1) { ["storage":"SplObjectStorage":private]=> array(1) { [0]=> array(2) { ["obj"]=> Segmentation fault (core dumped) ``` ASan ``` /php-src/ext/spl/spl_directory.c:637:7: runtime error: member access within null pointer of type 'php_stream' (aka 'struct _php_stream') SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/spl/spl_directory.c:637:7 ``` ### PHP Version PHP 8.4.0-dev ### Operating System ubuntu 22.04

« previous php.bugs (#247158) next »