-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Use after free in php_dom.c #16150
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
Labels
Comments
Simplified: <?php
$e1 = new DOMElement("E1");
$e2 = new DOMElement("E2");
$e3 = new DOMElement("E3");
$doc = new DOMDocument(); // Must be placed here so it is destroyed first
$doc->appendChild($e3);
$e2->append($e1);
$e3->appendChild ($e2);
echo $doc->saveXML(); |
The problem is that when |
nielsdos
added a commit
to nielsdos/php-src
that referenced
this issue
Oct 2, 2024
The reference counts of the internal document pointer are mismanaged. In the case of fragments the refcount may be increased too much, while for other cases the document reference may not be applied to all children. This bug existed for a long time and this doesn't reproduce (easily) on 8.2 due to other bugs. Furthermore 8.2 will enter security mode soon, and this change may be too risky.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following code:
Resulted in this output:
But I expected this output instead:
PHP Version
PHP 8.4.0-dev
Operating System
No response
The text was updated successfully, but these errors were encountered: