You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Sebastian Wannemaker <se...@gmail.com> on 2014/05/19 10:16:24 UTC
Crash in XalanTransformer::transform with MSVC10 32bit
Hi,
I am trying to get Xalan-C++ working, but it fails with an "invalid null
pointer" assertion (in "VisualStudio10\Vc\INCLUDE\xutility" Line 2237.).
Unfortunately I am completely clueless what's going on. So I am grateful
for any advice how to understand what is going on and/or how to solve this
issue.
This is my code:
#include <iostream>
#include <xercesc/util/PlatformUtils.hpp>
#include <xalanc/Include/PlatformDefinitions.hpp>
#include <xalanc/XalanTransformer/XalanTransformer.hpp>
int main(int argc, char *argv[])
{
try {
xercesc::XMLPlatformUtils::Initialize();
xalanc::XalanTransformer::initialize();
}
catch(...){
std::cout << "initialization failed" << std::endl;
return -1;
}
{
xalanc::XSLTInputSource xmlInput("D:\\file.xml");
xalanc::XSLTInputSource xsltInput("D:\\style.xslt");
xalanc::XSLTResultTarget outTarget("D:\\out.xml");
xalanc::XalanTransformer theXalanTransformer;
int theResult = theXalanTransformer.transform(xmlInput, xsltInput,
outTarget);
std::cout << theResult << std::endl;
}
xalanc::XalanTransformer::terminate();
xercesc::XMLPlatformUtils::Terminate();
xalanc::XalanTransformer::ICUCleanUp();
return 0;
}
As a backtrace I get:
0 std::_Debug_message MSVCP100D 0xf8e9953
1 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x1008a68f
2 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x1008a438
3 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x10094487
4 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x100933e6
5 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x100d30d7
6 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x100d08db
7 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x100cae4d
8 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x101ee4fd
9 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x101dbcc4
10 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x101db98d
11 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x102090de
12 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x102c6bb8
13 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x1030ce42
14 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x1033ed22
15 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x10334824
16 xalanc_1_11::AttributesImpl::AttributesImpl Xalan_C_1_11D 0x1033b746
17 main main.cpp 22 0x186f06
18 __tmainCRTStartup crtexe.c 555 0x18638f
19 mainCRTStartup crtexe.c 371 0x1861bf
... <Mehr>
If I run "Xalan.exe -t d:\file.xml d:\style.xslt" however, it works fine.
My system is MSVC 10, 32-bit and I
use xalan_comb-1.11-x86-windows-VC100.zip.
Thanks and best regards
Sebastion
Re: Crash in XalanTransformer::transform with MSVC10 32bit
Posted by Scott Yuan <yu...@yahoo.com>.
Hi Sebastian,
Given that it crashes with null pointer error around XalanDOMString.hpp(59) and ICUCleanUp() doesn't seem to play any role with the crash, it may be related to
https://issues.apache.org/jira/browse/XALANC-744
Here is my one liner patch for the issue and hope it helps:
Index: src/xalanc/PlatformSupport/XalanLocator.hpp
===================================================================
--- src/xalanc/PlatformSupport/XalanLocator.hpp (revision 1580726)
+++ src/xalanc/PlatformSupport/XalanLocator.hpp (working copy)
@@ -91,7 +91,7 @@
const XalanDOMChar* theAlternateId = getEmptyPtr())
{
return theLocator == 0 ? theAlternateId : (theLocator->getSystemId() ?
- theLocator->getPublicId() : theAlternateId);
+ theLocator->getSystemId() : theAlternateId);
}
/**
Regards,
Scott
On Wednesday, May 21, 2014 1:23 AM, Sebastian Wannemaker <se...@gmail.com> wrote:
Hi Scott,
thanks for your answer. Unfortunately, removing ICUCleanUp() don't solve the issue. While digging a little bit deeper, it crashes in Microsoft Visual Studio 10.0\VC\include\xutility line 2237:
template<class _InIt,
class _OutTy,
size_t _OutSize> inline
_OutTy *copy(_InIt _First, _InIt _Last,
_OutTy (&_Dest)[_OutSize])
{// copy [_First, _Last) to [_Dest, ...)
return (_Unchecked(
_STD copy(_First, _Last, // <--- THIS IS LINE 2237
_Array_iterator<_OutTy, _OutSize>(_Dest))));
}
#endif /* _ITERATOR_DEBUG_LEVEL == 0 */
What should I say, shame on me, I disobey the elementary rule "Treat compiler warnings as errors"... While compiling I get
warning C4996: 'std::_Copy_backward': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
caused by XalanVector.hpp(282), XalanVector.hpp(274), XalanDOMString.hpp(59) and some more cases. Even if I do not know how to deal with this exactly, I am a step further and can dig there.
Thanks
Sebastian
2014-05-21 6:33 GMT+02:00 Scott Yuan <yu...@yahoo.com>:
>Hi Sebastian,
>
>I will try removing following line
>
> xalanc::XalanTransformer::ICUCleanUp();
>
>and see it still crash.
>
>Regards,
>
>Scott Yuan
>
Re: Crash in XalanTransformer::transform with MSVC10 32bit
Posted by Sebastian Wannemaker <se...@gmail.com>.
Hi Scott,
thanks for your answer. Unfortunately, removing ICUCleanUp() don't solve
the issue. While digging a little bit deeper, it crashes in Microsoft
Visual Studio 10.0\VC\include\xutility line 2237:
template<class _InIt,
class _OutTy,
size_t _OutSize> inline
_OutTy *copy(_InIt _First, _InIt _Last,
_OutTy (&_Dest)[_OutSize])
{ // copy [_First, _Last) to [_Dest, ...)
return (_Unchecked(
_STD copy(_First, _Last, // <--- THIS IS LINE 2237
_Array_iterator<_OutTy, _OutSize>(_Dest))));
}
#endif /* _ITERATOR_DEBUG_LEVEL == 0 */
What should I say, shame on me, I disobey the elementary rule "Treat
compiler warnings as errors"... While compiling I get
warning C4996: 'std::_Copy_backward': Function call with parameters that
may be unsafe - this call relies on the caller to check that the passed
values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS.
See documentation on how to use Visual C++ 'Checked Iterators'
caused by XalanVector.hpp(282), XalanVector.hpp(274), XalanDOMString.hpp(59)
and some more cases. Even if I do not know how to deal with this exactly, I
am a step further and can dig there.
Thanks
Sebastian
2014-05-21 6:33 GMT+02:00 Scott Yuan <yu...@yahoo.com>:
>
> Hi Sebastian,
>
> I will try removing following line
>
> xalanc::XalanTransformer::ICUCleanUp();
>
> and see it still crash.
>
> Regards,
>
> Scott Yuan
>
Re: Crash in XalanTransformer::transform with MSVC10 32bit
Posted by Scott Yuan <yu...@yahoo.com>.
Hi Sebastian,
I will try removing following line
xalanc::XalanTransformer::ICUCleanUp();
and see it still crash.
Regards,
Scott Yuan