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 2010/05/11 22:09:28 UTC
svn commit: r943263 - in /xml/security/trunk/c: CHANGELOG.txt
Projects/VC10.0/xsec/ Projects/VC10.0/xsec/xsec_lib/xsec_lib.vcxproj
lib/Makefile.am src/dsig/DSIGKeyInfoX509.cpp src/utils/XSECAutoPtr.hpp
Author: scantor
Date: Tue May 11 20:09:27 2010
New Revision: 943263
URL: http://svn.apache.org/viewvc?rev=943263&view=rev
Log:
https://issues.apache.org/bugzilla/show_bug.cgi?id=49264
Added:
xml/security/trunk/c/src/utils/XSECAutoPtr.hpp (with props)
Modified:
xml/security/trunk/c/CHANGELOG.txt
xml/security/trunk/c/Projects/VC10.0/xsec/ (props changed)
xml/security/trunk/c/Projects/VC10.0/xsec/xsec_lib/xsec_lib.vcxproj
xml/security/trunk/c/lib/Makefile.am
xml/security/trunk/c/src/dsig/DSIGKeyInfoX509.cpp
Modified: xml/security/trunk/c/CHANGELOG.txt
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/CHANGELOG.txt?rev=943263&r1=943262&r2=943263&view=diff
==============================================================================
--- xml/security/trunk/c/CHANGELOG.txt (original)
+++ xml/security/trunk/c/CHANGELOG.txt Tue May 11 20:09:27 2010
@@ -6,6 +6,7 @@ Changes since 1.5.1
* Fix for bug#49255, vector index bug (SC)
* Fix for bug#49257, stylesheet append bug (SC)
* Fix for bug#49260, header guard in XPath transform header (SC)
+* Fix for bug#49264, string release crash (SC)
* Expose algorithm URI on Signature and Reference objects (SC)
* White/blacklisting of otherwise registered algorithms (SC)
Propchange: xml/security/trunk/c/Projects/VC10.0/xsec/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue May 11 20:09:27 2010
@@ -1,3 +1,7 @@
*.sdf
*.suo
+
+ipch
+
+*.opensdf
Modified: xml/security/trunk/c/Projects/VC10.0/xsec/xsec_lib/xsec_lib.vcxproj
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/Projects/VC10.0/xsec/xsec_lib/xsec_lib.vcxproj?rev=943263&r1=943262&r2=943263&view=diff
==============================================================================
--- xml/security/trunk/c/Projects/VC10.0/xsec/xsec_lib/xsec_lib.vcxproj (original)
+++ xml/security/trunk/c/Projects/VC10.0/xsec/xsec_lib/xsec_lib.vcxproj Tue May 11 20:09:27 2010
@@ -661,6 +661,7 @@ xcopy /I /s /f ..\..\..\..\src\*.hpp ..\
<ClInclude Include="..\..\..\..\src\enc\NSS\NSSCryptoProvider.hpp" />
<ClInclude Include="..\..\..\..\src\enc\NSS\NSSCryptoSymmetricKey.hpp" />
<ClInclude Include="..\..\..\..\src\enc\NSS\NSSCryptoX509.hpp" />
+ <ClInclude Include="..\..\..\..\src\utils\XSECAutoPtr.hpp" />
<ClInclude Include="..\..\..\..\src\utils\XSECBinTXFMInputStream.hpp" />
<ClInclude Include="..\..\..\..\src\utils\XSECDOMUtils.hpp" />
<ClInclude Include="..\..\..\..\src\utils\XSECNameSpaceExpander.hpp" />
Modified: xml/security/trunk/c/lib/Makefile.am
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/lib/Makefile.am?rev=943263&r1=943262&r2=943263&view=diff
==============================================================================
--- xml/security/trunk/c/lib/Makefile.am (original)
+++ xml/security/trunk/c/lib/Makefile.am Tue May 11 20:09:27 2010
@@ -239,7 +239,8 @@ utils_sources = \
../src/utils/XSECSOAPRequestorSimple.cpp \
../src/utils/XSECSOAPRequestor.hpp \
../src/utils/XSECNameSpaceExpander.cpp \
- ../src/utils/XSECPlatformUtils.cpp
+ ../src/utils/XSECPlatformUtils.cpp \
+ ../src/utils/XSECAutoPtr.hpp
# XML Encryption
Modified: xml/security/trunk/c/src/dsig/DSIGKeyInfoX509.cpp
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/src/dsig/DSIGKeyInfoX509.cpp?rev=943263&r1=943262&r2=943263&view=diff
==============================================================================
--- xml/security/trunk/c/src/dsig/DSIGKeyInfoX509.cpp (original)
+++ xml/security/trunk/c/src/dsig/DSIGKeyInfoX509.cpp Tue May 11 20:09:27 2010
@@ -33,6 +33,8 @@
#include <xercesc/util/Janitor.hpp>
+#include "../utils/XSECAutoPtr.hpp"
+
XERCES_CPP_NAMESPACE_USE
// --------------------------------------------------------------------------------
@@ -566,8 +568,7 @@ void DSIGKeyInfoX509::appendX509Certific
m_X509List.push_back(h);
h->mp_encodedX509 = b64Txt->getNodeValue();
h->mp_cryptoX509 = XSECPlatformUtils::g_cryptoProvider->X509();
- char * charX509 = XMLString::transcode(h->mp_encodedX509);
- ArrayJanitor<char> j_charX509(charX509);
- h->mp_cryptoX509->loadX509Base64Bin(charX509, (unsigned int) strlen(charX509));
+ XSECAutoPtrChar charX509(h->mp_encodedX509);
+ h->mp_cryptoX509->loadX509Base64Bin(charX509.get(), (unsigned int) strlen(charX509.get()));
}
Added: xml/security/trunk/c/src/utils/XSECAutoPtr.hpp
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/src/utils/XSECAutoPtr.hpp?rev=943263&view=auto
==============================================================================
--- xml/security/trunk/c/src/utils/XSECAutoPtr.hpp (added)
+++ xml/security/trunk/c/src/utils/XSECAutoPtr.hpp Tue May 11 20:09:27 2010
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2010 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XSECAutoPtr := internal classes for RAII handling of transcoded data
+ *
+ * Author(s): Scott Cantor
+ *
+ * $Id:$
+ *
+ */
+
+
+#ifndef XSECAUTOPTR_INCLUDE
+#define XSECAUTOPTR_INCLUDE
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xercesc/util/XMLString.hpp>
+
+XSEC_USING_XERCES(XMLString);
+
+/**
+ * \addtogroup internal
+ * @{
+ */
+
+ /**
+ * A minimal auto_ptr-like class that can copy or transcode a buffer into
+ * the local code page and free the result automatically.
+ *
+ * Needed because a standard auto_ptr would use delete on the resulting
+ * pointer.
+ */
+class XSECAutoPtrChar
+{
+ XSECAutoPtrChar(const XSECAutoPtrChar&);
+ XSECAutoPtrChar& operator=(const XSECAutoPtrChar&);
+public:
+ XSECAutoPtrChar() : m_buf(nullptr) {
+ }
+
+ XSECAutoPtrChar(const XMLCh* src) : m_buf(xercesc::XMLString::transcode(src)) {
+ }
+
+ XSECAutoPtrChar(const char* src) : m_buf(xercesc::XMLString::replicate(src)) {
+ }
+
+ ~XSECAutoPtrChar() {
+ xercesc::XMLString::release(&m_buf);
+ }
+
+ const char* get() const {
+ return m_buf;
+ }
+
+ char* release() {
+ char* temp=m_buf; m_buf=nullptr; return temp;
+ }
+
+private:
+ char* m_buf;
+};
+
+/**
+ * A minimal auto_ptr-like class that can copy or transcode a buffer into
+ * 16-bit Unicode and free the result automatically.
+ *
+ * Needed because a standard auto_ptr would use delete on the resulting
+ * pointer.
+ */
+class XSECAutoPtrXMLCh
+{
+ XSECAutoPtrXMLCh(const XSECAutoPtrXMLCh&);
+ XSECAutoPtrXMLCh& operator=(const XSECAutoPtrXMLCh&);
+public:
+ XSECAutoPtrXMLCh() : m_buf(nullptr) {
+ }
+
+ XSECAutoPtrXMLCh(const char* src) : m_buf(xercesc::XMLString::transcode(src)) {
+ }
+
+ XSECAutoPtrXMLCh(const XMLCh* src) : m_buf(xercesc::XMLString::replicate(src)) {
+ }
+
+ ~XSECAutoPtrXMLCh() {
+ xercesc::XMLString::release(&m_buf);
+ }
+
+ const XMLCh* get() const {
+ return m_buf;
+ }
+
+ XMLCh* release() {
+ XMLCh* temp=m_buf; m_buf=nullptr; return temp;
+ }
+
+private:
+ XMLCh* m_buf;
+};
+
+/** @} */
+
+#endif /* XSECAUTOPTR_INCLUDE */
+
Propchange: xml/security/trunk/c/src/utils/XSECAutoPtr.hpp
------------------------------------------------------------------------------
svn:mime-type = text/plain