Package: xqilla
Version: 2.3.3-2
Tags: patch

Xerces-C 3.2.0 removed castToNode (which relied on undefined behaviour) with a cleaner way of getting information about a node's containing node: a new fContainingNode member.

The attached patchs have conditionals for the 3.2.0 and earlier behaviour, so should be safe to apply without any breakage. Tested on FreeBSD 11.1 and 10.3 for the xqilla port, and Debian unstable for the Debian package.

See also: https://sourceforge.net/p/xqilla/bugs/48/


Regards,
Roger
diff -urN XQilla-2.3.3.orig/src/dom-api/impl/XPathDocumentImpl.cpp XQilla-2.3.3/src/dom-api/impl/XPathDocumentImpl.cpp
--- XQilla-2.3.3.orig/src/dom-api/impl/XPathDocumentImpl.cpp	2015-05-18 18:38:59.000000000 +0100
+++ XQilla-2.3.3/src/dom-api/impl/XPathDocumentImpl.cpp	2017-09-03 22:15:41.999739206 +0100
@@ -62,7 +62,11 @@
     if (thisNodeImpl->isReadOnly())
         throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, getMemoryManager());
 
+#if _XERCES_VERSION >= 30200
+    DOMNode* thisNode = fParent.fContainingNode;
+#else
     DOMNode* thisNode = castToNode(&fParent);
+#endif
     if (newChild->getOwnerDocument() != thisNode)
         throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, getMemoryManager());
 
diff -urN XQilla-2.3.3.orig/src/dom-api/impl/XPathNamespaceImpl.cpp XQilla-2.3.3/src/dom-api/impl/XPathNamespaceImpl.cpp
--- XQilla-2.3.3.orig/src/dom-api/impl/XPathNamespaceImpl.cpp	2015-05-18 18:39:00.000000000 +0100
+++ XQilla-2.3.3/src/dom-api/impl/XPathNamespaceImpl.cpp	2017-09-03 22:15:46.031991028 +0100
@@ -33,7 +33,11 @@
 
 XPathNamespaceImpl::XPathNamespaceImpl(const XMLCh* const nsPrefix, 
 		const XMLCh* const nsUri, DOMElement *owner, DOMDocument *docOwner) 
+#if _XERCES_VERSION >= 30200 
+	: fNode(this, docOwner)
+#else
 	: fNode(docOwner)
+#endif
 {
     DOMNodeImpl *argImpl = castToNodeImpl(this);
 
@@ -54,7 +58,13 @@
 }
 
 XPathNamespaceImpl::XPathNamespaceImpl(const XPathNamespaceImpl &other) 
-	: fNode(other.fNode), uri(other.uri), prefix(other.prefix)
+#if _XERCES_VERSION >= 30200 
+	: fNode(this, other.fNode),
+#else
+	: fNode(other.fNode), 
+
+#endif
+	  uri(other.uri), prefix(other.prefix)
 {
 }
 
@@ -196,7 +206,11 @@
 
     //if it is a custom node and bigger than us we must ask it for the order
     if(otherType > DOMXPathNamespace::XPATH_NAMESPACE_NODE) {
+#if _XERCES_VERSION >= 30200 
+        DOMNodeImpl tmp(const_cast<XPathNamespaceImpl *>(this), 0);
+#else
         DOMNodeImpl tmp(0);
+#endif
 #if _XERCES_VERSION >= 30000
         return tmp.reverseTreeOrderBitPattern(other->compareDocumentPosition(this));
 #else

Reply via email to