Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ext/xsl/xsltprocessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ static void xsl_add_ns_def(xmlNodePtr node)
ns->type = XML_LOCAL_NAMESPACE;
ns->href = should_free ? attr_value : xmlStrdup(attr_value);
ns->prefix = attr->ns->prefix ? xmlStrdup(attr->name) : NULL;

if (UNEXPECTED(ns->href == NULL || (attr->ns->prefix != NULL && ns->prefix == NULL))) {
xmlFreeNs(ns);
return;
}

ns->next = node->nsDef;
node->nsDef = ns;
}
Expand Down Expand Up @@ -350,6 +356,9 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
php_libxml_increment_doc_ref(intern->doc, doc);

ctxt = xsltNewTransformContext(style, doc);
if (UNEXPECTED(ctxt == NULL)) {
goto out;
}
ctxt->_private = (void *) intern;

if (intern->parameter) {
Expand Down
Loading