[php-src] PR #22468: Fix use-after-free in XPath php:function argument nodes
| From: | iliaal | Date: | Fri, 26 Jun 2026 13:18:08 +0000 |
| Subject: | [php-src] PR #22468: Fix use-after-free in XPath php:function argument nodes | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36668@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22468
Author: iliaal
When an XPath php:function() callback removes a node passed to it as an argument, the node is freed
the moment the callback returns because the argument cleanup drops the only proxy holding it, while
libxml still references that node in the running evaluation's node-set. The read inside
xmlXPathEvalExpression() is then a use-after-free. Returned nodes are already kept alive in the
registry node list for the evaluation's duration; argument node and node-set proxies now get
the same treatment.