Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-673

Assertion failed with XalanDOMString::substr

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.10
    • None
    • XalanC
    • 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''.

      Attachments

        1. xalanc-673.patch
          0.5 kB
          David N Bertoni

        Activity

          People

            dbertoni David N Bertoni
            cbuh Aleksandr Vinokurov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0.5h
                0.5h
                Logged:
                Time Spent - Not Specified
                Not Specified