[php-src] Issue #13827: Null pointer access of type 'zval' in phpdbg_frame
| From: | YuanchengJiang | Date: | Thu, 28 Mar 2024 11:30:14 +0000 |
| Subject: | [php-src] Issue #13827: Null pointer access of type 'zval' in phpdbg_frame | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246664@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13827
Author: YuanchengJiang
### Description
Run the following test file (phpt):
```
--TEST--
UBSan phpdbg_frame member access within null pointer of type 'zval'
--FILE--
<?php
class C {
public function __destruct() {
echo __METHOD__, "\n";
}
}
$fiber = new Fiber(function () {
$c = new C();
$fiber = Fiber::getCurrent();
Fiber::suspend();
});
$fiber->start();
gc_collect_cycles();
$fiber = null;
gc_collect_cycles();
?>
--PHPDBG--
r
t
ev 1 + 2
c
q
--EXPECT--
C::__destruct
```
Resulted in this output:
```
[Successful compilation of /test.php]
prompt> [Uncaught GracefulExit in on line 0: ]
>00014: Fiber::suspend();
00015: });
00016:
prompt> frame #0: {closure}() at /test.php:14
//php-src/sapi/phpdbg/phpdbg_frame.c:295:2: runtime error: member access within null pointer of type
'zval' (aka 'struct _zval_struct')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/sapi/phpdbg/phpdbg_frame.c:295:2 in
```
### PHP Version
PHP 8.4.0-dev
### Operating System
ubuntu 22.04