Skip to content

Fix #66783: UAF when appending DOMDocument to element #6765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Mar 12, 2021

According to the DOM standard, elements may only contain element, text,
processing instruction and comment nodes[1]. It is also specified that
a HierarchyRequestError should be thrown if a document is to be
inserted[2]. We follow that standard, and prevent the use-after-free
this way.

[1] https://dom.spec.whatwg.org/#node-trees
[2] https://dom.spec.whatwg.org/#mutation-algorithms

According to the DOM standard, elements may only contain element, text,
processing instruction and comment nodes[1].  It is also specified that
a HierarchyRequestError should be thrown if a document is to be
inserted[2].  We follow that standard, and prevent the use-after-free
this way.

[1] <https://dom.spec.whatwg.org/#node-trees>
[2] <https://dom.spec.whatwg.org/#mutation-algorithms>
@cmb69 cmb69 added the Bug label Mar 12, 2021
@cmb69
Copy link
Member Author

cmb69 commented Mar 12, 2021

cc @beberlei

@cmb69
Copy link
Member Author

cmb69 commented Mar 15, 2021

The test failures are not related to this PR.

@php-pulls php-pulls closed this in a08847a Mar 17, 2021
@cmb69 cmb69 deleted the cmb/66783 branch March 17, 2021 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants