Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-771

PatchAvailable - surroundContents seg-faults

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.1.0
    • 2.2.0
    • DOM
    • None
    • Operating System: Other
      Platform: Other
    • 15796

    Description

      I get a segmentation fault when do the following pseudo-code:
      createRange()
      surroundContents(document_element)

      The fault appears to lie in DOMRangeImpl::checkReadOnly - namely that it
      assumes endOffset > 0 - which it is not after createRange() - it is 0 by
      definition.
      So my patch just adds an if (endOffset > 0).
      I am not convinced the rest of the routine is correct though -
      recurseTreeAndCheck only gets called once, not once for each child. I have not
      attempted to change this though, as it may be correct. In any case, my patch
      cures the seg fault (I then get a DOMException code 3, which suggests to me
      that I shouldn't do this sequence of operations - I must re-read on Range, but
      in any case, if I do program violate pre-conditions, I am entitled to an
      exception rather than a seg-fault).

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--patch
          0.1 kB
          Colin Adams

        Activity

          People

            Unassigned Unassigned
            colin@colina.demon.co.uk Colin Adams
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: