You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Rene van Hoek (JIRA)" <xa...@xml.apache.org> on 2005/03/09 11:15:53 UTC

[jira] Created: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

         Key: XALANC-463
         URL: http://issues.apache.org/jira/browse/XALANC-463
     Project: XalanC
        Type: Bug
  Components: XalanC  
    Versions: 1.9    
 Environment: Xerces 2.6 (9/30/2004)
Xalan 1.9 (12/22/2004)
Os: Windows 2000 Advanced Server
Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Linker: Microsoft (R) Incremental Linker Version 7.10.3077
    Reporter: Rene van Hoek
    Priority: Critical
 Attachments: Xalan19Transform.zip

Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.

The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
The XSL style-sheet opens with the function 'document()' an other XML document. 
The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.

The behaviour does not occur with Xalan 1.8
The behaviour does not occur when the XSL style-sheet does not open an other XML document.
The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.

source-code:
=================

#include <xalanc/Include/PlatformDefinitions.hpp>

#if defined(XALAN_CLASSIC_IOSTREAMS)
#include <iostream.h>
#else
#include <iostream>
#endif

#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/dom/DOMDocument.hpp>

#include <xalanc/XalanTransformer/XalanTransformer.hpp>
#include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
#include <xalanc/XalanTransformer/XalanParsedSource.hpp>

#include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>

int
main(
			int		argc,
			char*	argv[])
{
	XALAN_USING_STD(cerr)
	XALAN_USING_STD(cout)
	XALAN_USING_STD(endl)

    if (argc < 3 || argc > 3)
	{
		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
		return -1;
	}

	int		theResult = -1;

	try
	{
		XALAN_USING_XERCES(XMLPlatformUtils)
    XALAN_USING_XERCES(XercesDOMParser)
    XALAN_USING_XERCES(DOMDocument)

		XALAN_USING_XALAN(XalanTransformer)
    XALAN_USING_XALAN(XercesParserLiaison)
    XALAN_USING_XALAN(XercesDOMSupport)
    XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
  
    XALAN_USING_XALAN(XalanParsedSource)
    XALAN_USING_XALAN(XalanParsedSourceHelper)

		// Call the static initializer for Xerces.
		XMLPlatformUtils::Initialize();

		// Initialize Xalan.
		XalanTransformer::initialize();

		{ 
      DOMDocument* parsedXml = NULL;
      XercesDOMParser parser;
      parser.parse(argv[1]);
            
      parsedXml = parser.getDocument();

      XercesDOMSupport    theDOMSupport;
      XercesParserLiaison theLiaison(theDOMSupport);        
      XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);

			// Create a XalanTransformer.
			XalanTransformer theXalanTransformer;
     			
			// Do the transform.
			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
      
			if(theResult != 0)
			{
				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
			}
			
		}

		// Terminate Xalan...
		XalanTransformer::terminate();

		// Terminate Xerces...
		XMLPlatformUtils::Terminate();

		// Clean up the ICU, if it's integrated...
		XalanTransformer::ICUCleanUp();
	}
	catch(...)
	{
		cerr << "An unknown error occurred!" << endl;
	}

	return theResult;
}

XSL-file:
===========

<?xml version="1.0" ?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0"/>

<xsl:template match="/">
<xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
<xsl:variable name="org" select="document($org_doc)"></xsl:variable>
<xsl:variable name="upd" select="/"></xsl:variable>
<xsl:variable name="upd_q_ids" select="$upd//question/@id"/>

<xsl:element name="questionnaire">
<xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
<xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>

<respondent-tracking>    
    <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
    <xsl:copy-of select="$upd/questionnaire/posting"/>
</respondent-tracking>

<responses>
<respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>

<xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
<xsl:copy-of select="$upd//question"/>
</responses>

</xsl:element>

</xsl:template>

</xsl:stylesheet>

XML-file parsed in program:
=============================

<?xml version="1.0" encoding="UTF-8"?>
<questionnaire id="1" questionnaire_session_id="1">
    <current_response_doc>response_org.xml</current_response_doc>
    <respondent-tracking>       
    </respondent-tracking>
    <responses>
        <respondent_id>{aa-bcd-23-0}</respondent_id>        
        <question id="{q-aa-4}">
            <answer id="{q-aa-4_a-1}">
                <text/>
            </answer>
        </question>
    </responses>
</questionnaire>


XML-file opened in XSL-sheet with 'document()' function
==========================================================
<?xml version="1.0" encoding="UTF-8"?>
<questionnaire id="1" questionnaire_session_id="1">
    <respondent-tracking>        
    </respondent-tracking>
    <responses>
        <respondent_id>{aa-bcd-23-0}</respondent_id>
        <question id="{q-aa-5}">
            <answer id="{q-aa-5_a-4}">
                <text/>
            </answer>
        </question>           
    </responses>
</questionnaire>



Call stack:
================
>	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
 	xerces-c_2_6D.dll!120b1d10() 	
 	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
 	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
 	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
 	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
 	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
 	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
 	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
 	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
 	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
 	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
 	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Posted by "Dmitry Hayes (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANC-463?page=comments#action_60528 ]
     
Dmitry Hayes commented on XALANC-463:
-------------------------------------

Yes, it's not a good idea to delete with the Xalan memory manager Xerces objects

> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: XALANC-463
>          URL: http://issues.apache.org/jira/browse/XALANC-463
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.9
>  Environment: Xerces 2.6 (9/30/2004)
> Xalan 1.9 (12/22/2004)
> Os: Windows 2000 Advanced Server
> Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Linker: Microsoft (R) Incremental Linker Version 7.10.3077
>     Reporter: Rene van Hoek
>     Assignee: David Bertoni
>     Priority: Critical
>  Attachments: Xalan19Transform.zip, patch.txt
>
> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
> The XSL style-sheet opens with the function 'document()' an other XML document. 
> The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.
> The behaviour does not occur with Xalan 1.8
> The behaviour does not occur when the XSL style-sheet does not open an other XML document.
> The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.
> source-code:
> =================
> #include <xalanc/Include/PlatformDefinitions.hpp>
> #if defined(XALAN_CLASSIC_IOSTREAMS)
> #include <iostream.h>
> #else
> #include <iostream>
> #endif
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xalanc/XalanTransformer/XalanTransformer.hpp>
> #include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> #include <xalanc/XalanTransformer/XalanParsedSource.hpp>
> #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
> #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
> int
> main(
> 			int		argc,
> 			char*	argv[])
> {
> 	XALAN_USING_STD(cerr)
> 	XALAN_USING_STD(cout)
> 	XALAN_USING_STD(endl)
>     if (argc < 3 || argc > 3)
> 	{
> 		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
> 		return -1;
> 	}
> 	int		theResult = -1;
> 	try
> 	{
> 		XALAN_USING_XERCES(XMLPlatformUtils)
>     XALAN_USING_XERCES(XercesDOMParser)
>     XALAN_USING_XERCES(DOMDocument)
> 		XALAN_USING_XALAN(XalanTransformer)
>     XALAN_USING_XALAN(XercesParserLiaison)
>     XALAN_USING_XALAN(XercesDOMSupport)
>     XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
>   
>     XALAN_USING_XALAN(XalanParsedSource)
>     XALAN_USING_XALAN(XalanParsedSourceHelper)
> 		// Call the static initializer for Xerces.
> 		XMLPlatformUtils::Initialize();
> 		// Initialize Xalan.
> 		XalanTransformer::initialize();
> 		{ 
>       DOMDocument* parsedXml = NULL;
>       XercesDOMParser parser;
>       parser.parse(argv[1]);
>             
>       parsedXml = parser.getDocument();
>       XercesDOMSupport    theDOMSupport;
>       XercesParserLiaison theLiaison(theDOMSupport);        
>       XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);
> 			// Create a XalanTransformer.
> 			XalanTransformer theXalanTransformer;
>      			
> 			// Do the transform.
> 			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
>       
> 			if(theResult != 0)
> 			{
> 				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
> 			}
> 			
> 		}
> 		// Terminate Xalan...
> 		XalanTransformer::terminate();
> 		// Terminate Xerces...
> 		XMLPlatformUtils::Terminate();
> 		// Clean up the ICU, if it's integrated...
> 		XalanTransformer::ICUCleanUp();
> 	}
> 	catch(...)
> 	{
> 		cerr << "An unknown error occurred!" << endl;
> 	}
> 	return theResult;
> }
> XSL-file:
> ===========
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml" version="1.0"/>
> <xsl:template match="/">
> <xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
> <xsl:variable name="org" select="document($org_doc)"></xsl:variable>
> <xsl:variable name="upd" select="/"></xsl:variable>
> <xsl:variable name="upd_q_ids" select="$upd//question/@id"/>
> <xsl:element name="questionnaire">
> <xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
> <xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>
> <respondent-tracking>    
>     <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
>     <xsl:copy-of select="$upd/questionnaire/posting"/>
> </respondent-tracking>
> <responses>
> <respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>
> <xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
> <xsl:copy-of select="$upd//question"/>
> </responses>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> XML-file parsed in program:
> =============================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <current_response_doc>response_org.xml</current_response_doc>
>     <respondent-tracking>       
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>        
>         <question id="{q-aa-4}">
>             <answer id="{q-aa-4_a-1}">
>                 <text/>
>             </answer>
>         </question>
>     </responses>
> </questionnaire>
> XML-file opened in XSL-sheet with 'document()' function
> ==========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <respondent-tracking>        
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>
>         <question id="{q-aa-5}">
>             <answer id="{q-aa-5_a-4}">
>                 <text/>
>             </answer>
>         </question>           
>     </responses>
> </questionnaire>
> Call stack:
> ================
> >	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
>  	xerces-c_2_6D.dll!120b1d10() 	
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
>  	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
>  	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
>  	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Resolved: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANC-463?page=history ]
     
David Bertoni resolved XALANC-463:
----------------------------------

     Resolution: Fixed
    Fix Version: CurrentCVS

Fixed with checking of xml-xalan/c/src/xalanc/XercesParserLiaison/XercesParserLiason.cpp;12

Can you please verify by checking out the latest version of this file, or by applying the patch I previously attached?

> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: XALANC-463
>          URL: http://issues.apache.org/jira/browse/XALANC-463
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.9
>  Environment: Xerces 2.6 (9/30/2004)
> Xalan 1.9 (12/22/2004)
> Os: Windows 2000 Advanced Server
> Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Linker: Microsoft (R) Incremental Linker Version 7.10.3077
>     Reporter: Rene van Hoek
>     Assignee: David Bertoni
>     Priority: Critical
>      Fix For: CurrentCVS
>  Attachments: Xalan19Transform.zip, patch.txt
>
> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
> The XSL style-sheet opens with the function 'document()' an other XML document. 
> The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.
> The behaviour does not occur with Xalan 1.8
> The behaviour does not occur when the XSL style-sheet does not open an other XML document.
> The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.
> source-code:
> =================
> #include <xalanc/Include/PlatformDefinitions.hpp>
> #if defined(XALAN_CLASSIC_IOSTREAMS)
> #include <iostream.h>
> #else
> #include <iostream>
> #endif
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xalanc/XalanTransformer/XalanTransformer.hpp>
> #include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> #include <xalanc/XalanTransformer/XalanParsedSource.hpp>
> #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
> #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
> int
> main(
> 			int		argc,
> 			char*	argv[])
> {
> 	XALAN_USING_STD(cerr)
> 	XALAN_USING_STD(cout)
> 	XALAN_USING_STD(endl)
>     if (argc < 3 || argc > 3)
> 	{
> 		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
> 		return -1;
> 	}
> 	int		theResult = -1;
> 	try
> 	{
> 		XALAN_USING_XERCES(XMLPlatformUtils)
>     XALAN_USING_XERCES(XercesDOMParser)
>     XALAN_USING_XERCES(DOMDocument)
> 		XALAN_USING_XALAN(XalanTransformer)
>     XALAN_USING_XALAN(XercesParserLiaison)
>     XALAN_USING_XALAN(XercesDOMSupport)
>     XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
>   
>     XALAN_USING_XALAN(XalanParsedSource)
>     XALAN_USING_XALAN(XalanParsedSourceHelper)
> 		// Call the static initializer for Xerces.
> 		XMLPlatformUtils::Initialize();
> 		// Initialize Xalan.
> 		XalanTransformer::initialize();
> 		{ 
>       DOMDocument* parsedXml = NULL;
>       XercesDOMParser parser;
>       parser.parse(argv[1]);
>             
>       parsedXml = parser.getDocument();
>       XercesDOMSupport    theDOMSupport;
>       XercesParserLiaison theLiaison(theDOMSupport);        
>       XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);
> 			// Create a XalanTransformer.
> 			XalanTransformer theXalanTransformer;
>      			
> 			// Do the transform.
> 			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
>       
> 			if(theResult != 0)
> 			{
> 				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
> 			}
> 			
> 		}
> 		// Terminate Xalan...
> 		XalanTransformer::terminate();
> 		// Terminate Xerces...
> 		XMLPlatformUtils::Terminate();
> 		// Clean up the ICU, if it's integrated...
> 		XalanTransformer::ICUCleanUp();
> 	}
> 	catch(...)
> 	{
> 		cerr << "An unknown error occurred!" << endl;
> 	}
> 	return theResult;
> }
> XSL-file:
> ===========
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml" version="1.0"/>
> <xsl:template match="/">
> <xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
> <xsl:variable name="org" select="document($org_doc)"></xsl:variable>
> <xsl:variable name="upd" select="/"></xsl:variable>
> <xsl:variable name="upd_q_ids" select="$upd//question/@id"/>
> <xsl:element name="questionnaire">
> <xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
> <xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>
> <respondent-tracking>    
>     <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
>     <xsl:copy-of select="$upd/questionnaire/posting"/>
> </respondent-tracking>
> <responses>
> <respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>
> <xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
> <xsl:copy-of select="$upd//question"/>
> </responses>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> XML-file parsed in program:
> =============================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <current_response_doc>response_org.xml</current_response_doc>
>     <respondent-tracking>       
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>        
>         <question id="{q-aa-4}">
>             <answer id="{q-aa-4_a-1}">
>                 <text/>
>             </answer>
>         </question>
>     </responses>
> </questionnaire>
> XML-file opened in XSL-sheet with 'document()' function
> ==========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <respondent-tracking>        
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>
>         <question id="{q-aa-5}">
>             <answer id="{q-aa-5_a-4}">
>                 <text/>
>             </answer>
>         </question>           
>     </responses>
> </questionnaire>
> Call stack:
> ================
> >	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
>  	xerces-c_2_6D.dll!120b1d10() 	
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
>  	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
>  	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
>  	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Updated: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Posted by "Rene van Hoek (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANC-463?page=history ]

Rene van Hoek updated XALANC-463:
---------------------------------

    Attachment: Xalan19Transform.zip

The zip file 'Xalan19Transform.zip' contains the source-code, XML and XSL files.


> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: XALANC-463
>          URL: http://issues.apache.org/jira/browse/XALANC-463
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.9
>  Environment: Xerces 2.6 (9/30/2004)
> Xalan 1.9 (12/22/2004)
> Os: Windows 2000 Advanced Server
> Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Linker: Microsoft (R) Incremental Linker Version 7.10.3077
>     Reporter: Rene van Hoek
>     Priority: Critical
>  Attachments: Xalan19Transform.zip
>
> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
> The XSL style-sheet opens with the function 'document()' an other XML document. 
> The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.
> The behaviour does not occur with Xalan 1.8
> The behaviour does not occur when the XSL style-sheet does not open an other XML document.
> The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.
> source-code:
> =================
> #include <xalanc/Include/PlatformDefinitions.hpp>
> #if defined(XALAN_CLASSIC_IOSTREAMS)
> #include <iostream.h>
> #else
> #include <iostream>
> #endif
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xalanc/XalanTransformer/XalanTransformer.hpp>
> #include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> #include <xalanc/XalanTransformer/XalanParsedSource.hpp>
> #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
> #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
> int
> main(
> 			int		argc,
> 			char*	argv[])
> {
> 	XALAN_USING_STD(cerr)
> 	XALAN_USING_STD(cout)
> 	XALAN_USING_STD(endl)
>     if (argc < 3 || argc > 3)
> 	{
> 		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
> 		return -1;
> 	}
> 	int		theResult = -1;
> 	try
> 	{
> 		XALAN_USING_XERCES(XMLPlatformUtils)
>     XALAN_USING_XERCES(XercesDOMParser)
>     XALAN_USING_XERCES(DOMDocument)
> 		XALAN_USING_XALAN(XalanTransformer)
>     XALAN_USING_XALAN(XercesParserLiaison)
>     XALAN_USING_XALAN(XercesDOMSupport)
>     XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
>   
>     XALAN_USING_XALAN(XalanParsedSource)
>     XALAN_USING_XALAN(XalanParsedSourceHelper)
> 		// Call the static initializer for Xerces.
> 		XMLPlatformUtils::Initialize();
> 		// Initialize Xalan.
> 		XalanTransformer::initialize();
> 		{ 
>       DOMDocument* parsedXml = NULL;
>       XercesDOMParser parser;
>       parser.parse(argv[1]);
>             
>       parsedXml = parser.getDocument();
>       XercesDOMSupport    theDOMSupport;
>       XercesParserLiaison theLiaison(theDOMSupport);        
>       XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);
> 			// Create a XalanTransformer.
> 			XalanTransformer theXalanTransformer;
>      			
> 			// Do the transform.
> 			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
>       
> 			if(theResult != 0)
> 			{
> 				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
> 			}
> 			
> 		}
> 		// Terminate Xalan...
> 		XalanTransformer::terminate();
> 		// Terminate Xerces...
> 		XMLPlatformUtils::Terminate();
> 		// Clean up the ICU, if it's integrated...
> 		XalanTransformer::ICUCleanUp();
> 	}
> 	catch(...)
> 	{
> 		cerr << "An unknown error occurred!" << endl;
> 	}
> 	return theResult;
> }
> XSL-file:
> ===========
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml" version="1.0"/>
> <xsl:template match="/">
> <xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
> <xsl:variable name="org" select="document($org_doc)"></xsl:variable>
> <xsl:variable name="upd" select="/"></xsl:variable>
> <xsl:variable name="upd_q_ids" select="$upd//question/@id"/>
> <xsl:element name="questionnaire">
> <xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
> <xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>
> <respondent-tracking>    
>     <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
>     <xsl:copy-of select="$upd/questionnaire/posting"/>
> </respondent-tracking>
> <responses>
> <respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>
> <xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
> <xsl:copy-of select="$upd//question"/>
> </responses>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> XML-file parsed in program:
> =============================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <current_response_doc>response_org.xml</current_response_doc>
>     <respondent-tracking>       
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>        
>         <question id="{q-aa-4}">
>             <answer id="{q-aa-4_a-1}">
>                 <text/>
>             </answer>
>         </question>
>     </responses>
> </questionnaire>
> XML-file opened in XSL-sheet with 'document()' function
> ==========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <respondent-tracking>        
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>
>         <question id="{q-aa-5}">
>             <answer id="{q-aa-5_a-4}">
>                 <text/>
>             </answer>
>         </question>           
>     </responses>
> </questionnaire>
> Call stack:
> ================
> >	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
>  	xerces-c_2_6D.dll!120b1d10() 	
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
>  	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
>  	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
>  	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Assigned: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANC-463?page=history ]

David Bertoni reassigned XALANC-463:
------------------------------------

    Assign To: David Bertoni

I have a fix for this which I will check in later today.

> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: XALANC-463
>          URL: http://issues.apache.org/jira/browse/XALANC-463
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.9
>  Environment: Xerces 2.6 (9/30/2004)
> Xalan 1.9 (12/22/2004)
> Os: Windows 2000 Advanced Server
> Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Linker: Microsoft (R) Incremental Linker Version 7.10.3077
>     Reporter: Rene van Hoek
>     Assignee: David Bertoni
>     Priority: Critical
>  Attachments: Xalan19Transform.zip
>
> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
> The XSL style-sheet opens with the function 'document()' an other XML document. 
> The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.
> The behaviour does not occur with Xalan 1.8
> The behaviour does not occur when the XSL style-sheet does not open an other XML document.
> The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.
> source-code:
> =================
> #include <xalanc/Include/PlatformDefinitions.hpp>
> #if defined(XALAN_CLASSIC_IOSTREAMS)
> #include <iostream.h>
> #else
> #include <iostream>
> #endif
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xalanc/XalanTransformer/XalanTransformer.hpp>
> #include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> #include <xalanc/XalanTransformer/XalanParsedSource.hpp>
> #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
> #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
> int
> main(
> 			int		argc,
> 			char*	argv[])
> {
> 	XALAN_USING_STD(cerr)
> 	XALAN_USING_STD(cout)
> 	XALAN_USING_STD(endl)
>     if (argc < 3 || argc > 3)
> 	{
> 		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
> 		return -1;
> 	}
> 	int		theResult = -1;
> 	try
> 	{
> 		XALAN_USING_XERCES(XMLPlatformUtils)
>     XALAN_USING_XERCES(XercesDOMParser)
>     XALAN_USING_XERCES(DOMDocument)
> 		XALAN_USING_XALAN(XalanTransformer)
>     XALAN_USING_XALAN(XercesParserLiaison)
>     XALAN_USING_XALAN(XercesDOMSupport)
>     XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
>   
>     XALAN_USING_XALAN(XalanParsedSource)
>     XALAN_USING_XALAN(XalanParsedSourceHelper)
> 		// Call the static initializer for Xerces.
> 		XMLPlatformUtils::Initialize();
> 		// Initialize Xalan.
> 		XalanTransformer::initialize();
> 		{ 
>       DOMDocument* parsedXml = NULL;
>       XercesDOMParser parser;
>       parser.parse(argv[1]);
>             
>       parsedXml = parser.getDocument();
>       XercesDOMSupport    theDOMSupport;
>       XercesParserLiaison theLiaison(theDOMSupport);        
>       XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);
> 			// Create a XalanTransformer.
> 			XalanTransformer theXalanTransformer;
>      			
> 			// Do the transform.
> 			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
>       
> 			if(theResult != 0)
> 			{
> 				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
> 			}
> 			
> 		}
> 		// Terminate Xalan...
> 		XalanTransformer::terminate();
> 		// Terminate Xerces...
> 		XMLPlatformUtils::Terminate();
> 		// Clean up the ICU, if it's integrated...
> 		XalanTransformer::ICUCleanUp();
> 	}
> 	catch(...)
> 	{
> 		cerr << "An unknown error occurred!" << endl;
> 	}
> 	return theResult;
> }
> XSL-file:
> ===========
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml" version="1.0"/>
> <xsl:template match="/">
> <xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
> <xsl:variable name="org" select="document($org_doc)"></xsl:variable>
> <xsl:variable name="upd" select="/"></xsl:variable>
> <xsl:variable name="upd_q_ids" select="$upd//question/@id"/>
> <xsl:element name="questionnaire">
> <xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
> <xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>
> <respondent-tracking>    
>     <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
>     <xsl:copy-of select="$upd/questionnaire/posting"/>
> </respondent-tracking>
> <responses>
> <respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>
> <xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
> <xsl:copy-of select="$upd//question"/>
> </responses>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> XML-file parsed in program:
> =============================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <current_response_doc>response_org.xml</current_response_doc>
>     <respondent-tracking>       
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>        
>         <question id="{q-aa-4}">
>             <answer id="{q-aa-4_a-1}">
>                 <text/>
>             </answer>
>         </question>
>     </responses>
> </questionnaire>
> XML-file opened in XSL-sheet with 'document()' function
> ==========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <respondent-tracking>        
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>
>         <question id="{q-aa-5}">
>             <answer id="{q-aa-5_a-4}">
>                 <text/>
>             </answer>
>         </question>           
>     </responses>
> </questionnaire>
> Call stack:
> ================
> >	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
>  	xerces-c_2_6D.dll!120b1d10() 	
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
>  	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
>  	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
>  	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Posted by "Alain Le Guennec (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANC-463?page=comments#action_12318503 ] 

Alain Le Guennec commented on XALANC-463:
-----------------------------------------

I just ran into that same problem with xalan-1-9,
and applying David's patch fixed it for me too. Thanks.


> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: XALANC-463
>          URL: http://issues.apache.org/jira/browse/XALANC-463
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.9
>  Environment: Xerces 2.6 (9/30/2004)
> Xalan 1.9 (12/22/2004)
> Os: Windows 2000 Advanced Server
> Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Linker: Microsoft (R) Incremental Linker Version 7.10.3077
>     Reporter: Rene van Hoek
>     Assignee: David Bertoni
>     Priority: Critical
>      Fix For: CurrentCVS
>  Attachments: Xalan19Transform.zip, patch.txt
>
> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
> The XSL style-sheet opens with the function 'document()' an other XML document. 
> The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.
> The behaviour does not occur with Xalan 1.8
> The behaviour does not occur when the XSL style-sheet does not open an other XML document.
> The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.
> source-code:
> =================
> #include <xalanc/Include/PlatformDefinitions.hpp>
> #if defined(XALAN_CLASSIC_IOSTREAMS)
> #include <iostream.h>
> #else
> #include <iostream>
> #endif
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xalanc/XalanTransformer/XalanTransformer.hpp>
> #include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> #include <xalanc/XalanTransformer/XalanParsedSource.hpp>
> #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
> #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
> int
> main(
> 			int		argc,
> 			char*	argv[])
> {
> 	XALAN_USING_STD(cerr)
> 	XALAN_USING_STD(cout)
> 	XALAN_USING_STD(endl)
>     if (argc < 3 || argc > 3)
> 	{
> 		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
> 		return -1;
> 	}
> 	int		theResult = -1;
> 	try
> 	{
> 		XALAN_USING_XERCES(XMLPlatformUtils)
>     XALAN_USING_XERCES(XercesDOMParser)
>     XALAN_USING_XERCES(DOMDocument)
> 		XALAN_USING_XALAN(XalanTransformer)
>     XALAN_USING_XALAN(XercesParserLiaison)
>     XALAN_USING_XALAN(XercesDOMSupport)
>     XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
>   
>     XALAN_USING_XALAN(XalanParsedSource)
>     XALAN_USING_XALAN(XalanParsedSourceHelper)
> 		// Call the static initializer for Xerces.
> 		XMLPlatformUtils::Initialize();
> 		// Initialize Xalan.
> 		XalanTransformer::initialize();
> 		{ 
>       DOMDocument* parsedXml = NULL;
>       XercesDOMParser parser;
>       parser.parse(argv[1]);
>             
>       parsedXml = parser.getDocument();
>       XercesDOMSupport    theDOMSupport;
>       XercesParserLiaison theLiaison(theDOMSupport);        
>       XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);
> 			// Create a XalanTransformer.
> 			XalanTransformer theXalanTransformer;
>      			
> 			// Do the transform.
> 			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
>       
> 			if(theResult != 0)
> 			{
> 				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
> 			}
> 			
> 		}
> 		// Terminate Xalan...
> 		XalanTransformer::terminate();
> 		// Terminate Xerces...
> 		XMLPlatformUtils::Terminate();
> 		// Clean up the ICU, if it's integrated...
> 		XalanTransformer::ICUCleanUp();
> 	}
> 	catch(...)
> 	{
> 		cerr << "An unknown error occurred!" << endl;
> 	}
> 	return theResult;
> }
> XSL-file:
> ===========
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml" version="1.0"/>
> <xsl:template match="/">
> <xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
> <xsl:variable name="org" select="document($org_doc)"></xsl:variable>
> <xsl:variable name="upd" select="/"></xsl:variable>
> <xsl:variable name="upd_q_ids" select="$upd//question/@id"/>
> <xsl:element name="questionnaire">
> <xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
> <xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>
> <respondent-tracking>    
>     <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
>     <xsl:copy-of select="$upd/questionnaire/posting"/>
> </respondent-tracking>
> <responses>
> <respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>
> <xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
> <xsl:copy-of select="$upd//question"/>
> </responses>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> XML-file parsed in program:
> =============================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <current_response_doc>response_org.xml</current_response_doc>
>     <respondent-tracking>       
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>        
>         <question id="{q-aa-4}">
>             <answer id="{q-aa-4_a-1}">
>                 <text/>
>             </answer>
>         </question>
>     </responses>
> </questionnaire>
> XML-file opened in XSL-sheet with 'document()' function
> ==========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <respondent-tracking>        
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>
>         <question id="{q-aa-5}">
>             <answer id="{q-aa-5_a-4}">
>                 <text/>
>             </answer>
>         </question>           
>     </responses>
> </questionnaire>
> Call stack:
> ================
> >	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
>  	xerces-c_2_6D.dll!120b1d10() 	
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
>  	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
>  	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
>  	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Updated: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANC-463?page=history ]

David Bertoni updated XALANC-463:
---------------------------------

    Attachment: patch.txt

Patch attached.  Would all committers please review?

> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: XALANC-463
>          URL: http://issues.apache.org/jira/browse/XALANC-463
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.9
>  Environment: Xerces 2.6 (9/30/2004)
> Xalan 1.9 (12/22/2004)
> Os: Windows 2000 Advanced Server
> Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Linker: Microsoft (R) Incremental Linker Version 7.10.3077
>     Reporter: Rene van Hoek
>     Assignee: David Bertoni
>     Priority: Critical
>  Attachments: Xalan19Transform.zip, patch.txt
>
> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
> The XSL style-sheet opens with the function 'document()' an other XML document. 
> The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.
> The behaviour does not occur with Xalan 1.8
> The behaviour does not occur when the XSL style-sheet does not open an other XML document.
> The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.
> source-code:
> =================
> #include <xalanc/Include/PlatformDefinitions.hpp>
> #if defined(XALAN_CLASSIC_IOSTREAMS)
> #include <iostream.h>
> #else
> #include <iostream>
> #endif
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xalanc/XalanTransformer/XalanTransformer.hpp>
> #include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> #include <xalanc/XalanTransformer/XalanParsedSource.hpp>
> #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
> #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
> int
> main(
> 			int		argc,
> 			char*	argv[])
> {
> 	XALAN_USING_STD(cerr)
> 	XALAN_USING_STD(cout)
> 	XALAN_USING_STD(endl)
>     if (argc < 3 || argc > 3)
> 	{
> 		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
> 		return -1;
> 	}
> 	int		theResult = -1;
> 	try
> 	{
> 		XALAN_USING_XERCES(XMLPlatformUtils)
>     XALAN_USING_XERCES(XercesDOMParser)
>     XALAN_USING_XERCES(DOMDocument)
> 		XALAN_USING_XALAN(XalanTransformer)
>     XALAN_USING_XALAN(XercesParserLiaison)
>     XALAN_USING_XALAN(XercesDOMSupport)
>     XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
>   
>     XALAN_USING_XALAN(XalanParsedSource)
>     XALAN_USING_XALAN(XalanParsedSourceHelper)
> 		// Call the static initializer for Xerces.
> 		XMLPlatformUtils::Initialize();
> 		// Initialize Xalan.
> 		XalanTransformer::initialize();
> 		{ 
>       DOMDocument* parsedXml = NULL;
>       XercesDOMParser parser;
>       parser.parse(argv[1]);
>             
>       parsedXml = parser.getDocument();
>       XercesDOMSupport    theDOMSupport;
>       XercesParserLiaison theLiaison(theDOMSupport);        
>       XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);
> 			// Create a XalanTransformer.
> 			XalanTransformer theXalanTransformer;
>      			
> 			// Do the transform.
> 			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
>       
> 			if(theResult != 0)
> 			{
> 				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
> 			}
> 			
> 		}
> 		// Terminate Xalan...
> 		XalanTransformer::terminate();
> 		// Terminate Xerces...
> 		XMLPlatformUtils::Terminate();
> 		// Clean up the ICU, if it's integrated...
> 		XalanTransformer::ICUCleanUp();
> 	}
> 	catch(...)
> 	{
> 		cerr << "An unknown error occurred!" << endl;
> 	}
> 	return theResult;
> }
> XSL-file:
> ===========
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml" version="1.0"/>
> <xsl:template match="/">
> <xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
> <xsl:variable name="org" select="document($org_doc)"></xsl:variable>
> <xsl:variable name="upd" select="/"></xsl:variable>
> <xsl:variable name="upd_q_ids" select="$upd//question/@id"/>
> <xsl:element name="questionnaire">
> <xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
> <xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>
> <respondent-tracking>    
>     <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
>     <xsl:copy-of select="$upd/questionnaire/posting"/>
> </respondent-tracking>
> <responses>
> <respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>
> <xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
> <xsl:copy-of select="$upd//question"/>
> </responses>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> XML-file parsed in program:
> =============================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <current_response_doc>response_org.xml</current_response_doc>
>     <respondent-tracking>       
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>        
>         <question id="{q-aa-4}">
>             <answer id="{q-aa-4_a-1}">
>                 <text/>
>             </answer>
>         </question>
>     </responses>
> </questionnaire>
> XML-file opened in XSL-sheet with 'document()' function
> ==========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <respondent-tracking>        
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>
>         <question id="{q-aa-5}">
>             <answer id="{q-aa-5_a-4}">
>                 <text/>
>             </answer>
>         </question>           
>     </responses>
> </questionnaire>
> Call stack:
> ================
> >	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
>  	xerces-c_2_6D.dll!120b1d10() 	
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
>  	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
>  	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
>  	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Posted by "Rene van Hoek (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANC-463?page=comments#action_60580 ]
     
Rene van Hoek commented on XALANC-463:
--------------------------------------

I verified by applying the patch and it is working ok now. I ran the transformation for several minutes within a while(true) loop and memory-usage was stable.

Thanks.


> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: XALANC-463
>          URL: http://issues.apache.org/jira/browse/XALANC-463
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.9
>  Environment: Xerces 2.6 (9/30/2004)
> Xalan 1.9 (12/22/2004)
> Os: Windows 2000 Advanced Server
> Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Linker: Microsoft (R) Incremental Linker Version 7.10.3077
>     Reporter: Rene van Hoek
>     Assignee: David Bertoni
>     Priority: Critical
>      Fix For: CurrentCVS
>  Attachments: Xalan19Transform.zip, patch.txt
>
> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
> The XSL style-sheet opens with the function 'document()' an other XML document. 
> The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.
> The behaviour does not occur with Xalan 1.8
> The behaviour does not occur when the XSL style-sheet does not open an other XML document.
> The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.
> source-code:
> =================
> #include <xalanc/Include/PlatformDefinitions.hpp>
> #if defined(XALAN_CLASSIC_IOSTREAMS)
> #include <iostream.h>
> #else
> #include <iostream>
> #endif
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xalanc/XalanTransformer/XalanTransformer.hpp>
> #include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> #include <xalanc/XalanTransformer/XalanParsedSource.hpp>
> #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
> #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
> int
> main(
> 			int		argc,
> 			char*	argv[])
> {
> 	XALAN_USING_STD(cerr)
> 	XALAN_USING_STD(cout)
> 	XALAN_USING_STD(endl)
>     if (argc < 3 || argc > 3)
> 	{
> 		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
> 		return -1;
> 	}
> 	int		theResult = -1;
> 	try
> 	{
> 		XALAN_USING_XERCES(XMLPlatformUtils)
>     XALAN_USING_XERCES(XercesDOMParser)
>     XALAN_USING_XERCES(DOMDocument)
> 		XALAN_USING_XALAN(XalanTransformer)
>     XALAN_USING_XALAN(XercesParserLiaison)
>     XALAN_USING_XALAN(XercesDOMSupport)
>     XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
>   
>     XALAN_USING_XALAN(XalanParsedSource)
>     XALAN_USING_XALAN(XalanParsedSourceHelper)
> 		// Call the static initializer for Xerces.
> 		XMLPlatformUtils::Initialize();
> 		// Initialize Xalan.
> 		XalanTransformer::initialize();
> 		{ 
>       DOMDocument* parsedXml = NULL;
>       XercesDOMParser parser;
>       parser.parse(argv[1]);
>             
>       parsedXml = parser.getDocument();
>       XercesDOMSupport    theDOMSupport;
>       XercesParserLiaison theLiaison(theDOMSupport);        
>       XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);
> 			// Create a XalanTransformer.
> 			XalanTransformer theXalanTransformer;
>      			
> 			// Do the transform.
> 			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
>       
> 			if(theResult != 0)
> 			{
> 				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
> 			}
> 			
> 		}
> 		// Terminate Xalan...
> 		XalanTransformer::terminate();
> 		// Terminate Xerces...
> 		XMLPlatformUtils::Terminate();
> 		// Clean up the ICU, if it's integrated...
> 		XalanTransformer::ICUCleanUp();
> 	}
> 	catch(...)
> 	{
> 		cerr << "An unknown error occurred!" << endl;
> 	}
> 	return theResult;
> }
> XSL-file:
> ===========
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml" version="1.0"/>
> <xsl:template match="/">
> <xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
> <xsl:variable name="org" select="document($org_doc)"></xsl:variable>
> <xsl:variable name="upd" select="/"></xsl:variable>
> <xsl:variable name="upd_q_ids" select="$upd//question/@id"/>
> <xsl:element name="questionnaire">
> <xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
> <xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>
> <respondent-tracking>    
>     <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
>     <xsl:copy-of select="$upd/questionnaire/posting"/>
> </respondent-tracking>
> <responses>
> <respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>
> <xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
> <xsl:copy-of select="$upd//question"/>
> </responses>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> XML-file parsed in program:
> =============================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <current_response_doc>response_org.xml</current_response_doc>
>     <respondent-tracking>       
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>        
>         <question id="{q-aa-4}">
>             <answer id="{q-aa-4_a-1}">
>                 <text/>
>             </answer>
>         </question>
>     </responses>
> </questionnaire>
> XML-file opened in XSL-sheet with 'document()' function
> ==========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <respondent-tracking>        
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>
>         <question id="{q-aa-5}">
>             <answer id="{q-aa-5_a-4}">
>                 <text/>
>             </answer>
>         </question>           
>     </responses>
> </questionnaire>
> Call stack:
> ================
> >	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
>  	xerces-c_2_6D.dll!120b1d10() 	
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
>  	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
>  	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
>  	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Closed: (XALANC-463) Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if XSL opens other XML document with 'document()' function.

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANC-463?page=all ]
     
David Bertoni closed XALANC-463:
--------------------------------


> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: XALANC-463
>          URL: http://issues.apache.org/jira/browse/XALANC-463
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.9
>  Environment: Xerces 2.6 (9/30/2004)
> Xalan 1.9 (12/22/2004)
> Os: Windows 2000 Advanced Server
> Compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Linker: Microsoft (R) Incremental Linker Version 7.10.3077
>     Reporter: Rene van Hoek
>     Assignee: David Bertoni
>     Priority: Critical
>      Fix For: CurrentCVS
>  Attachments: Xalan19Transform.zip, patch.txt
>
> Transforming an XML DOM document encapsulated within an XercesDOMWrapperParsedSource object triggers an invalid heap pointer exception if  XSL opens other XML document with 'document()' function.
> The XML is parsed and stored in an XercesDOMWrapperParsedSource object.
> The XSL style-sheet opens with the function 'document()' an other XML document. 
> The transformation itself goes ok. When the destructors are called, an 'delete' is deleting memory in a wrong heap.
> The behaviour does not occur with Xalan 1.8
> The behaviour does not occur when the XSL style-sheet does not open an other XML document.
> The behaviour does not occur when the XML is not stored in an XercesDOMWrapperParsedSource object.
> source-code:
> =================
> #include <xalanc/Include/PlatformDefinitions.hpp>
> #if defined(XALAN_CLASSIC_IOSTREAMS)
> #include <iostream.h>
> #else
> #include <iostream>
> #endif
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xalanc/XalanTransformer/XalanTransformer.hpp>
> #include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> #include <xalanc/XalanTransformer/XalanParsedSource.hpp>
> #include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
> #include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
> int
> main(
> 			int		argc,
> 			char*	argv[])
> {
> 	XALAN_USING_STD(cerr)
> 	XALAN_USING_STD(cout)
> 	XALAN_USING_STD(endl)
>     if (argc < 3 || argc > 3)
> 	{
> 		cerr << "Usage: XalanTransform XMLFileName XSLFileName " << endl;
> 		return -1;
> 	}
> 	int		theResult = -1;
> 	try
> 	{
> 		XALAN_USING_XERCES(XMLPlatformUtils)
>     XALAN_USING_XERCES(XercesDOMParser)
>     XALAN_USING_XERCES(DOMDocument)
> 		XALAN_USING_XALAN(XalanTransformer)
>     XALAN_USING_XALAN(XercesParserLiaison)
>     XALAN_USING_XALAN(XercesDOMSupport)
>     XALAN_USING_XALAN(XercesDOMWrapperParsedSource)    
>   
>     XALAN_USING_XALAN(XalanParsedSource)
>     XALAN_USING_XALAN(XalanParsedSourceHelper)
> 		// Call the static initializer for Xerces.
> 		XMLPlatformUtils::Initialize();
> 		// Initialize Xalan.
> 		XalanTransformer::initialize();
> 		{ 
>       DOMDocument* parsedXml = NULL;
>       XercesDOMParser parser;
>       parser.parse(argv[1]);
>             
>       parsedXml = parser.getDocument();
>       XercesDOMSupport    theDOMSupport;
>       XercesParserLiaison theLiaison(theDOMSupport);        
>       XercesDOMWrapperParsedSource theSource(parsedXml, theLiaison, theDOMSupport);
> 			// Create a XalanTransformer.
> 			XalanTransformer theXalanTransformer;
>      			
> 			// Do the transform.
> 			theResult = theXalanTransformer.transform(theSource, argv[2], cout);
>       
> 			if(theResult != 0)
> 			{
> 				cerr << "Error: " << theXalanTransformer.getLastError() << endl;
> 			}
> 			
> 		}
> 		// Terminate Xalan...
> 		XalanTransformer::terminate();
> 		// Terminate Xerces...
> 		XMLPlatformUtils::Terminate();
> 		// Clean up the ICU, if it's integrated...
> 		XalanTransformer::ICUCleanUp();
> 	}
> 	catch(...)
> 	{
> 		cerr << "An unknown error occurred!" << endl;
> 	}
> 	return theResult;
> }
> XSL-file:
> ===========
> <?xml version="1.0" ?> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml" version="1.0"/>
> <xsl:template match="/">
> <xsl:variable name="org_doc"><xsl:value-of select="./questionnaire/current_response_doc"/></xsl:variable>
> <xsl:variable name="org" select="document($org_doc)"></xsl:variable>
> <xsl:variable name="upd" select="/"></xsl:variable>
> <xsl:variable name="upd_q_ids" select="$upd//question/@id"/>
> <xsl:element name="questionnaire">
> <xsl:attribute name="id"><xsl:value-of select="$upd/questionnaire/@id"/></xsl:attribute>
> <xsl:attribute name="questionnaire_session_id"><xsl:value-of select="$upd/questionnaire/@questionnaire_session_id"/></xsl:attribute>
> <respondent-tracking>    
>     <xsl:copy-of select="$org/questionnaire/respondent-tracking//posting"/>
>     <xsl:copy-of select="$upd/questionnaire/posting"/>
> </respondent-tracking>
> <responses>
> <respondent_id><xsl:value-of select="$upd/questionnaire/responses/respondent_id"/></respondent_id>
> <xsl:copy-of select="$org//question[not(@id = $upd_q_ids)]"/>
> <xsl:copy-of select="$upd//question"/>
> </responses>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> XML-file parsed in program:
> =============================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <current_response_doc>response_org.xml</current_response_doc>
>     <respondent-tracking>       
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>        
>         <question id="{q-aa-4}">
>             <answer id="{q-aa-4_a-1}">
>                 <text/>
>             </answer>
>         </question>
>     </responses>
> </questionnaire>
> XML-file opened in XSL-sheet with 'document()' function
> ==========================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <questionnaire id="1" questionnaire_session_id="1">
>     <respondent-tracking>        
>     </respondent-tracking>
>     <responses>
>         <respondent_id>{aa-bcd-23-0}</respondent_id>
>         <question id="{q-aa-5}">
>             <answer id="{q-aa-5_a-4}">
>                 <text/>
>             </answer>
>         </question>           
>     </responses>
> </questionnaire>
> Call stack:
> ================
> >	msvcr71d.dll!operator delete(void * pUserData=0x006a5d80)  Line 52 + 0x51	C++
>  	xerces-c_2_6D.dll!120b1d10() 	
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::reset()  Line 140 + 0x28	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesParserLiaison::~XercesParserLiaison()  Line 116	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::~XercesDOMParsedSourceHelper()  Line 60 + 0xb	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XercesDOMParsedSourceHelper::`vector deleting destructor'()  + 0x57	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::MemMgrAutoPtrData::deallocate()  Line 83 + 0x14	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>::~XalanMemMgrAutoPtr<xalanc_1_9::XalanParsedSourceHelper,1>()  Line 146	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::doTransform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTInputSource * theStylesheetSource=0x00000000, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 1307 + 0x93	C++
>  	Xalan-C_1_9D.dll!xalanc_1_9::XalanTransformer::transform(const xalanc_1_9::XalanParsedSource & theParsedXML={...}, const xalanc_1_9::XalanCompiledStylesheet * theCompiledStylesheet=0x0066ac38, const xalanc_1_9::XSLTResultTarget & theResultTarget={...})  Line 188	C++
>  	Xalan19Transform.exe!main(int argc=3, char * * argv=0x003a6890)  Line 104 + 0x5b	C++
>  	Xalan19Transform.exe!mainCRTStartup()  Line 398 + 0x11	C
>  	KERNEL32.DLL!7c59893d() 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org