You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2003/01/04 12:14:35 UTC

DO NOT REPLY [Bug 15796] New: - PatchAvailable - surroundContents seg-faults

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15796>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15796

PatchAvailable - surroundContents seg-faults

           Summary: PatchAvailable - surroundContents seg-faults
           Product: Xerces-C++
           Version: 2.1.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: colin@colina.demon.co.uk


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).

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org