File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ PHP NEWS
12
12
. Fixed regression where signs after the first one were ignored while parsing
13
13
a signed integer, with the DateTimeInterface::modify() function. (Derick)
14
14
15
+ - DOM:
16
+ . Fixed bug GH-16039 (Segmentation fault (access null pointer) in
17
+ ext/dom/parentnode/tree.c). (nielsdos)
18
+
15
19
- PHPDBG:
16
20
. Fixed bug GH-15901 (phpdbg: Assertion failure on i funcs). (cmb)
17
21
Original file line number Diff line number Diff line change @@ -272,6 +272,11 @@ static zend_result dom_sanity_check_node_list_for_insertion(php_libxml_ref_obj *
272
272
if (instanceof_function (ce , dom_node_class_entry )) {
273
273
xmlNodePtr node = dom_object_get_node (Z_DOMOBJ_P (nodes + i ));
274
274
275
+ if (!node ) {
276
+ php_dom_throw_error (INVALID_STATE_ERR , /* strict */ true);
277
+ return FAILURE ;
278
+ }
279
+
275
280
if (node -> doc != documentNode ) {
276
281
php_dom_throw_error (WRONG_DOCUMENT_ERR , dom_get_strict_error (document ));
277
282
return FAILURE ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-16039 (Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c)
3
+ --EXTENSIONS--
4
+ dom
5
+ --FILE--
6
+ <?php
7
+
8
+ $ dom = new DOMDocument ;
9
+ $ element = $ dom ->appendChild ($ dom ->createElement ('root ' ));
10
+ try {
11
+ $ element ->prepend ('x ' , new DOMEntity );
12
+ } catch (DOMException $ e ) {
13
+ echo $ e ->getMessage (), "\n" ;
14
+ }
15
+ echo $ dom ->saveXML ();
16
+ $ dom ->strictErrorChecking = false ; // Should not have influence
17
+ try {
18
+ $ element ->prepend ('x ' , new DOMEntity );
19
+ } catch (DOMException $ e ) {
20
+ echo $ e ->getMessage (), "\n" ;
21
+ }
22
+ echo $ dom ->saveXML ();
23
+
24
+ ?>
25
+ --EXPECT--
26
+ Invalid State Error
27
+ <? xml version="1.0 "?>
28
+ <root/>
29
+ Invalid State Error
30
+ <? xml version="1.0 "?>
31
+ <root/>
You can’t perform that action at this time.
0 commit comments