[php-src] Issue #15570: Segmentation fault (access null pointer) in ext/dom/html5_serializer.c
| From: | YuanchengJiang | Date: | Sat, 24 Aug 2024 14:45:02 +0000 |
| Subject: | [php-src] Issue #15570: Segmentation fault (access null pointer) in ext/dom/html5_serializer.c | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247585@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15570
Author: YuanchengJiang
### Description
The following code:
```php
<?php
$html = <<<HTML
<head>
</html>
HTML;
$dom = Dom\HTMLDocument::createFromString($html);
$a = $dom->head->firstChild->cloneNode(false);
echo $dom->saveHTML($a), "\n";
```
Resulted in this output:
```
/php-src/ext/dom/html5_serializer.c:134:20: runtime error: member access within null pointer of type
'struct _xmlNode'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/dom/html5_serializer.c:134:20
in
```
### PHP Version
PHP 8.4.0-dev
### Operating System
ubuntu 22.04