[php-src] Issue #14698: Segmentation fault (access null pointer) in ext/libxml/libxml.c
| From: | YuanchengJiang | Date: | Fri, 28 Jun 2024 08:13:14 +0000 |
| Subject: | [php-src] Issue #14698: Segmentation fault (access null pointer) in ext/libxml/libxml.c | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247166@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14698
Author: YuanchengJiang
### Description
The following code:
```php
<?php
$dom = new DOMDocument;
$dom->loadHTML('<span title=""y">x</span><span
title=""z">x</span>');
$html = simplexml_import_dom($dom);
foreach ($html->body->span as $obj) {
}
$script1_dataflow = $html;
$array = ['foo'];
foreach ($array as $key => &$value) {
unset($script1_dataflow[$key]);
}
```
Resulted in this output:
```
Segmentation fault (core dumped)
```
UBSan:
```
/php-src/ext/libxml/libxml.c:333:16: runtime error: member access within null pointer of type
'php_libxml_node_object' (aka 'struct _php_libxml_node_object')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/libxml/libxml.c:333:16
```
### PHP Version
PHP 8.4.0-dev
### Operating System
ubuntu 22.04