Skip to content

Segmentation fault (access null pointer) in ext/dom/html5_serializer.c #15570

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions