After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 129967 - xinclude 2003, coredump on StringRange
xinclude 2003, coredump on StringRange
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2003-12-24 20:28 UTC by Oleg Paraschenko
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Oleg Paraschenko 2003-12-24 20:28:08 UTC
Code is from CVS, dated by 24 December 2003.

Source XML files:

----- <source.xml>
<chapter>
  <p>Sentence 1.  Sentence 2.</p>
  <p><i>Sentence 3.  Sentence 4.</i>  Sentence 5.</p>
</chapter>
----- </source.xml>

----- <document.xml>
<?xml version='1.0'?>
<document>
  <p>The relevant excerpt is:</p>
  <quotation>
    <include xmlns="http://www.w3.org/2003/XInclude"
       href="source.xml"
xpointer="xpointer(string-range(chapter/p[1],'Sentence 2')/
             range-to(string-range(chapter/p[2]/i,'3.',1,2)))"/>
  </quotation>
</document>
----- </document.xml>

It is expected that after processing of XInclude result is:

----- <expected>
<?xml version='1.0'?>
<document>
  <p>The relevant excerpt is:</p>
  <quotation>
    <p xml:base="http://www.example.com/source.xml">Sentence 2.</p>
  <p xml:base="http://www.example.com/source.xml"><i>Sentence 3.</i></p>
  </quotation>
</document>
----- <expected>

but actual result is:

----- <screen>
$ ~/p/libxml/bin/xmllint --xinclude document.xml 
Segmentation fault (core dumped)
$ gdb ~/p/libxml/bin/xmllint core
...
  • #0 xmlXPtrStringRangeFunction
    at xpointer.c line 2791
  • #0 xmlXPtrStringRangeFunction
    at xpointer.c line 2791
  • #1 xmlXPathCompOpEval
    at xpath.c line 10290
  • #2 xmlXPathCompOpEval
    at xpath.c line 10592
  • #3 xmlXPathCompOpEval
    at xpath.c line 10575
  • #4 xmlXPathRunEval
    at xpath.c line 10694
  • #5 xmlXPtrEvalXPtrPart
    at xpointer.c line 1032
  • #6 xmlXPtrEvalFullXPtr
    at xpointer.c line 1140
  • #7 xmlXPtrEvalXPointer
    at xpointer.c line 1267
  • #8 xmlXPtrEval
  • #9 xmlXIncludeLoadDoc
    at xinclude.c line 1460
  • #10 xmlXIncludeLoadNode
    at xinclude.c line 1867
  • #11 xmlXIncludeDoProcess
    at xinclude.c line 2140
  • #12 xmlXIncludeProcessFlags
    at xinclude.c line 2200
  • #13 parseAndPrintFile
    at xmllint.c line 1010
  • #14 main
    at xmllint.c line 1977
  • #15 __libc_start_main
    from /lib/libc.so.6

Comment 1 William M. Brack 2003-12-31 08:04:54 UTC
I have implemented (in CVS) substantial changes to xpath.c, 
xinclude.c and xpointer.c which seem to fix this problem.  Please 
note that the xpointer expression needs an additional '/', within 
the second string-range, i.e.:

xpointer="xpointer(string-range(chapter/p[1],'Sentence 2')/
             range-to(string-range(/chapter/p[2]/i,'3.',1,2)))"/>

Please try out these changes and report any further trouble - thanks!

Bill
Comment 2 Oleg Paraschenko 2003-12-31 12:07:03 UTC
Thanks for fixing! I'll return back in the beginning of the January.

Happy New Year!
Comment 3 Oleg Paraschenko 2004-01-03 15:21:54 UTC
Thanks, works. Closing.