File tree 3 files changed +23
-2
lines changed 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ PHP NEWS
24
24
- DOM:
25
25
. Fixed bug GH-15551 (Segmentation fault (access null pointer) in
26
26
ext/dom/xml_common.h). (nielsdos)
27
+ . Fixed bug GH-15570 (Segmentation fault (access null pointer) in
28
+ ext/dom/html5_serializer.c). (nielsdos)
27
29
28
30
- FPM:
29
31
. Added memory peak to the scoreboard / status page. (Flávio Heleno)
Original file line number Diff line number Diff line change @@ -137,8 +137,8 @@ static zend_result dom_html5_serialize_text_node(dom_html5_serialize_context *ct
137
137
return SUCCESS ;
138
138
}
139
139
140
- if ( node -> parent -> type == XML_ELEMENT_NODE && php_dom_ns_is_fast ( node -> parent , php_dom_ns_is_html_magic_token )) {
141
- const xmlNode * parent = node -> parent ;
140
+ const xmlNode * parent = node -> parent ;
141
+ if ( parent != NULL && parent -> type == XML_ELEMENT_NODE && php_dom_ns_is_fast ( parent , php_dom_ns_is_html_magic_token )) {
142
142
size_t name_length = strlen ((const char * ) parent -> name );
143
143
/* Spec tells us to only emit noscript content as-is if scripting is enabled.
144
144
* However, the user agent (PHP) does not support (JS) scripting.
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-15570 (Segmentation fault (access null pointer) in ext/dom/html5_serializer.c)
3
+ --CREDITS--
4
+ YuanchengJiang
5
+ --EXTENSIONS--
6
+ dom
7
+ --FILE--
8
+ <?php
9
+ $ html = <<<HTML
10
+ <head>
11
+ </html>
12
+ HTML ;
13
+ $ dom = Dom \HTMLDocument::createFromString ($ html , LIBXML_NOERROR );
14
+ $ a = $ dom ->head ->firstChild ->cloneNode (false );
15
+ var_dump ($ dom ->saveHTML ($ a ));
16
+ ?>
17
+ --EXPECT--
18
+ string(1) "
19
+ "
You can’t perform that action at this time.
0 commit comments