Details
-
Bug
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
1.10
-
None
-
None
-
SunOS 5.9
Generic_118558-30 sun4u sparc SUNW,Sun-Fire-280R, 32 bit compilation fails with this assertion, when 64 bit not
Description
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''.