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