[php-src] Issue #15496: Segmentation fault (access null pointer) in Zend/zend_stack.c
| From: | YuanchengJiang | Date: | Mon, 19 Aug 2024 13:23:28 +0000 |
| Subject: | [php-src] Issue #15496: Segmentation fault (access null pointer) in Zend/zend_stack.c | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247534@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15496
Author: YuanchengJiang
### Description
The following code:
```php
<?php
function output_html($ext) {
}
class MySessionHandler implements SessionHandlerInterface {
function open ($save_path, $session_name): bool {
return true;
}
function close(): bool {
}
function read ($id): string {
return '';
}
function write ($id, $sess_data): bool {
ob_start("output_html");
}
function destroy ($id): bool {
}
function gc ($maxlifetime): int {
}
}
session_set_save_handler(new MySessionHandler());
session_start();
ob_start(function() {
for ($i = count($a); $i > 0; --$x) {
}
});
while (1) {
$a[] = 1;
}
```
Resulted in this output:
```
/php-src/Zend/zend_stack.c:40:9: runtime error: applying zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/Zend/zend_stack.c:40:9
```
### PHP Version
PHP 8.4.0-dev
### Operating System
ubuntu 22.04