Repository navigation
Conversation
|
Looks good to me. @jordikroon Can you take a look at this? (as author of 9498bc3) |
|
The |
iliaal
left a comment
There was a problem hiding this comment.
Removing the parent assignment fixes it on its own: once parent is NULL, the generic parentNode and isConnected handlers already return null/false, and parentElement, getRootNode() and contains() read the same pointer. So the two new handlers, their declarations and the comment can go. 9498bc3 shipped in 8.6.0, so this should target PHP-8.6 with a NEWS entry.
Commit 9498bc3 wired Dom\Notation to its owning DocType by setting ret->parent = parent_dtd in create_notation. Because the orphan xmlEntity allocated for the wrapper is not in any tree, the parent pointer dangles once the DocType is removed and freed, triggering a use-after-free when parentNode is read (e.g. via var_dump on the surviving notation). Drop the parent assignment and align Dom\Notation::$parentNode with the W3C DOM Level 3 Core specification (always null) and ::$isConnected with it (always false). ownerDocument and baseURI keep working through doc.
| ret->SystemID = xmlStrdup(SystemID); | ||
| if (parent_dtd != NULL) { | ||
| ret->parent = parent_dtd; | ||
| /* Don't store parent_dtd: orphan notation can outlive the DTD when |
There was a problem hiding this comment.
Nit: with ret->parent no longer set, the generic parentNode and isConnected handlers already return null/false, so the two notation handlers, their declarations and this comment can go.
Commit 9498bc3 wired Dom\Notation to its owning DocType by setting
ret->parent = parent_dtd in create_notation. Because the orphan xmlEntity
allocated for the wrapper is not in any tree, the parent pointer dangles
once the DocType is removed and freed, triggering a use-after-free when
parentNode is read (e.g. via var_dump on the surviving notation).
Drop the parent assignment and align Dom\Notation::$parentNode with the
W3C DOM Level 3 Core specification (always null) and ::$isConnected with
it (always false). ownerDocument and baseURI keep working through doc.