Skip to content

ext/xsl: discard partially-constructed xmlNs on xmlStrdup failure#21888

Closed
iliaal wants to merge 1 commit intophp:PHP-8.4from
iliaal:fix/xsl-add-ns-def-strdup-null-8.4
Closed

ext/xsl: discard partially-constructed xmlNs on xmlStrdup failure#21888
iliaal wants to merge 1 commit intophp:PHP-8.4from
iliaal:fix/xsl-add-ns-def-strdup-null-8.4

Conversation

@iliaal
Copy link
Copy Markdown
Contributor

@iliaal iliaal commented Apr 27, 2026

If xmlStrdup fails for either href or prefix in xsl_add_ns_def, the partially-constructed xmlNs (NULL href, or NULL prefix when one was expected) was linked into node->nsDef. Subsequent libxml2 traversal of the namespace chain dereferenced those NULLs. Free the xmlNs via xmlFreeNs and return without linking it.

If xmlStrdup fails for either href or prefix in xsl_add_ns_def, the
malformed xmlNs (NULL href, or NULL prefix when one was expected) was
linked into node->nsDef. Subsequent libxml2 traversal of the namespace
chain dereferenced those NULLs.

Free the xmlNs via xmlFreeNs and return without linking it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant