Assertion failed with XalanDOMString::substr
--------------------------------------------
Key: XALANC-673
URL: https://issues.apache.org/jira/browse/XALANC-673
Project: XalanC
Issue Type: Bug
Components: XalanC
Affects Versions: 1.10
Environment: SunOS 5.9
Generic_118558-30 sun4u sparc SUNW,Sun-Fire-280R, 32 bit compilation fails with
this assertion, when 64 bit not
Reporter: Aleksandr Vinokurov
Priority: Trivial
There is an assertion failure with this code:
-----------------------<cut>-------------------------<
#include <xalanc/XalanTransformer/XalanTransformer.hpp>
#include <xalanc/XalanDOM/XalanDOMString.hpp>
XALAN_USING(XALAN_CPP_NAMESPACE, XalanDOMString)
int main(void) {
XALAN_USING_XERCES(XMLPlatformUtils)
XALAN_USING_XALAN(XalanTransformer)
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();
XalanDOMString a("xxxxxxxxxxx"), b;
a.substr(b); //the same as a.substr(b, 0,
XalanDOMString::npos);
return 0;
}
-----------------------<cut>-------------------------<
Here goes the output:
-----------------------<cut>-------------------------<
Assertion failed: thePosition < theSource.size() && thePosition + theCount
<= theSource.size(), file
/u02/home/avinokur/xalan-c/xml-xalan/c/src/xalanc/XalanDOM/XalanDOMString.cp
p, line 224
Abort (core dumped)
-----------------------<cut>-------------------------<
As I've found the assertion fails in "thePosition + theCount <=
theSource.size()" code, computing it to "0 + 4294967295 <= 11". Trying
"a.substr(b, 1)", the condition will be "1 + 4294967295 <= 11" which is "0 <
11" due to "typedef unsigned int size_type;" code from
``xalanc/XalanDOM/XalanDOMString.hpp''.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]