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 2011/05/07 23:46:45 UTC

svn commit: r1100635 - in /santuario/xml-security-cpp/trunk: CHANGELOG.txt xsec/dsig/DSIGObject.cpp

Author: scantor
Date: Sat May  7 21:46:44 2011
New Revision: 1100635

URL: http://svn.apache.org/viewvc?rev=1100635&view=rev
Log:
SANTUARIO-270: DSIGObject::load method crashes for ds:Object without Id attribute.

Modified:
    santuario/xml-security-cpp/trunk/CHANGELOG.txt
    santuario/xml-security-cpp/trunk/xsec/dsig/DSIGObject.cpp

Modified: santuario/xml-security-cpp/trunk/CHANGELOG.txt
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/CHANGELOG.txt?rev=1100635&r1=1100634&r2=1100635&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/CHANGELOG.txt (original)
+++ santuario/xml-security-cpp/trunk/CHANGELOG.txt Sat May  7 21:46:44 2011
@@ -1,5 +1,6 @@
 Changes since 1.6.0
 * [SANTUARIO-268] - TXFMXPathFilter->evaluateExpr crashes on Windows
+* [SANTUARIO-270] - DSIGObject::load method crashes for ds:Object without Id attribute
 
 Changes since 1.5.1
 =====================================

Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGObject.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGObject.cpp?rev=1100635&r1=1100634&r2=1100635&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGObject.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGObject.cpp Sat May  7 21:46:44 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2010 The Apache Software Foundation.
+ * Copyright 2002-2011 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -132,13 +132,13 @@ void DSIGObject::load(void) {
 
 
 	mp_idAttr = ((DOMElement *) mp_objectNode)->getAttributeNodeNS(NULL, s_Id);
+	if (mp_idAttr) {
 #if defined (XSEC_XERCES_HAS_SETIDATTRIBUTE)
-	((DOMElement *) mp_objectNode)->setIdAttributeNS(NULL, s_Id);
-#else
-#  if defined (XSEC_XERCES_HAS_BOOLSETIDATTRIBUTE)
+	    ((DOMElement *) mp_objectNode)->setIdAttributeNS(NULL, s_Id);
+#elif defined (XSEC_XERCES_HAS_BOOLSETIDATTRIBUTE)
 		((DOMElement *) mp_objectNode)->setIdAttributeNS(NULL, s_Id, true);
-#  endif
 #endif
+	}
 
 	mp_mimeTypeAttr = ((DOMElement *) mp_objectNode)->getAttributeNodeNS(NULL, s_MimeType);
 	mp_encodingAttr = ((DOMElement *) mp_objectNode)->getAttributeNodeNS(NULL, s_Encoding);
@@ -224,10 +224,8 @@ void DSIGObject::setId(const XMLCh * id)
 		// Mark as an ID
 #if defined (XSEC_XERCES_HAS_SETIDATTRIBUTE)
 		((DOMElement *) mp_objectNode)->setIdAttributeNS(NULL, s_Id);
-#else
-#  if defined (XSEC_XERCES_HAS_BOOLSETIDATTRIBUTE)
+#elif defined (XSEC_XERCES_HAS_BOOLSETIDATTRIBUTE)
 		((DOMElement *) mp_objectNode)->setIdAttributeNS(NULL, s_Id, true);
-#  endif
 #endif
 		mp_idAttr = ((DOMElement *) mp_objectNode)->getAttributeNodeNS(NULL, s_Id);