You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by sc...@apache.org on 2009/07/20 23:10:48 UTC

svn commit: r796012 - in /xml/security/trunk/c: CHANGELOG.txt src/canon/XSECC14n20010315.cpp src/canon/XSECXMLNSStack.cpp src/canon/XSECXMLNSStack.hpp

Author: scantor
Date: Mon Jul 20 21:10:48 2009
New Revision: 796012

URL: http://svn.apache.org/viewvc?rev=796012&view=rev
Log:
https://issues.apache.org/bugzilla/show_bug.cgi?id=47353

Modified:
    xml/security/trunk/c/CHANGELOG.txt
    xml/security/trunk/c/src/canon/XSECC14n20010315.cpp
    xml/security/trunk/c/src/canon/XSECXMLNSStack.cpp
    xml/security/trunk/c/src/canon/XSECXMLNSStack.hpp

Modified: xml/security/trunk/c/CHANGELOG.txt
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/CHANGELOG.txt?rev=796012&r1=796011&r2=796012&view=diff
==============================================================================
--- xml/security/trunk/c/CHANGELOG.txt (original)
+++ xml/security/trunk/c/CHANGELOG.txt Mon Jul 20 21:10:48 2009
@@ -1,5 +1,6 @@
 Changes since 1.5
 =====================================
+* Fix for bug#47353 in c14n of default namespaces (SC)
 * Fix Sparc compilation bug (SC)
 * Fix for CVE-2009-0217 (SC)
 

Modified: xml/security/trunk/c/src/canon/XSECC14n20010315.cpp
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/src/canon/XSECC14n20010315.cpp?rev=796012&r1=796011&r2=796012&view=diff
==============================================================================
--- xml/security/trunk/c/src/canon/XSECC14n20010315.cpp (original)
+++ xml/security/trunk/c/src/canon/XSECC14n20010315.cpp Mon Jul 20 21:10:48 2009
@@ -1338,6 +1338,11 @@
 				}
 				nsnode = m_nsStack.getNextNamespace();
 			}
+
+			// Fix for bug#47353, make sure we set xmlnsFound regardless of what the printing process saw.
+	        if (!xmlnsFound)
+	            xmlnsFound = m_nsStack.isNonEmptyDefaultNS();
+
 		} /* if (m_useNamespaceStack) */
 
 

Modified: xml/security/trunk/c/src/canon/XSECXMLNSStack.cpp
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/src/canon/XSECXMLNSStack.cpp?rev=796012&r1=796011&r2=796012&view=diff
==============================================================================
--- xml/security/trunk/c/src/canon/XSECXMLNSStack.cpp (original)
+++ xml/security/trunk/c/src/canon/XSECXMLNSStack.cpp Mon Jul 20 21:10:48 2009
@@ -201,7 +201,8 @@
 
 	while (it != m_currentNS.end()) {
 		t = (*it);
-		if (t->mp_ns == ns  && t->m_isDefault == false) {
+		// Fix for bug#47353, go ahead and track printing of default namespaces.
+		if (t->mp_ns == ns) { //  && t->m_isDefault == false) {
 			t->mp_printed = elt;
 			break;
 		}
@@ -242,3 +243,15 @@
 	return (*m_currentNSIterator)->mp_ns;
 
 }
+
+// Fix for bug#47353, explicit check for non-empty default NS decl.
+bool XSECXMLNSStack::isNonEmptyDefaultNS(void) {
+    for (XSECNSHolderVectorType::iterator it = m_currentNS.begin(); it != m_currentNS.end(); ++it) {
+        if ((*it)->m_isDefault) {
+            const XMLCh* val = (*it)->mp_ns->getNodeValue();
+            if (val && *val)
+                return true;
+        }
+    }
+    return false;
+}

Modified: xml/security/trunk/c/src/canon/XSECXMLNSStack.hpp
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/src/canon/XSECXMLNSStack.hpp?rev=796012&r1=796011&r2=796012&view=diff
==============================================================================
--- xml/security/trunk/c/src/canon/XSECXMLNSStack.hpp (original)
+++ xml/security/trunk/c/src/canon/XSECXMLNSStack.hpp Mon Jul 20 21:10:48 2009
@@ -82,6 +82,8 @@
 	// Mark the namespace as printed
 	void printNamespace(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * ns, 
 		XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * elt);
+	// Return whether the stack includes xmlns="something"
+	bool isNonEmptyDefaultNS(void);
 
 private: