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 583442 - buggy string-range() XPointer function
buggy string-range() XPointer function
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: xpointer
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2009-05-21 12:11 UTC by Jakub Wilk
Modified: 2021-07-05 13:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test script (322 bytes, text/plain)
2009-05-21 12:12 UTC, Jakub Wilk
Details

Description Jakub Wilk 2009-05-21 12:11:05 UTC
I discovered several flaws in the string-range() XPointer function 
implementation.


1. Some edge cases fail:

$ ./test-xpointer '<a>xyzw</a>' "string-range(/a, 'xy', 1, 4)"
-:2: element include: XInclude error : XPointer evaluation failed: #xpointer(string-range(/a, 'xy', 1, 4))
-:2: element include: XInclude error : could not load /tmp/tmp.XXXXWeW45c, and no fallback was found
<?xml version="1.0"?>
<root><include xmlns="http://www.w3.org/2003/XInclude" href="/tmp/tmp.XXXXWeW45c" xpointer="xpointer(string-range(/a, 'xy', 1, 4))"/></root>

$ ./test-xpointer '<a>xyzw</a>' "string-range(/a, 'xy', 1, 3)"
-:2: element include: XInclude error : XPointer evaluation failed: #xpointer(string-range(/a, 'xy', 1, 3))
-:2: element include: XInclude error : could not load /tmp/tmp.XXXXdTlLwI, and no fallback was found
<?xml version="1.0"?>
<root><include xmlns="http://www.w3.org/2003/XInclude" href="/tmp/tmp.XXXXdTlLwI" xpointer="xpointer(string-range(/a, 'xy', 1, 3))"/></root>


2. Returned strings are typically one character longer than requested:

$ ./test-xpointer '<a>xyzw</a>' "string-range(/a, 'xy', 1, 2)"
<?xml version="1.0"?>
<root>xyz</root>


3. Searching for a single-character string triggers an infinite loop:

$ ./test-xpointer '<a>xyzw</a>' "string-range(/a, 'x')"


4. Character counting is broken for non-ASCII characters:

$ ./test-xpointer '<a>żółw</a>' "string-range(/a, 'żółw', 1, 4)"
<?xml version="1.0"?>
<root>&#x17C;&#xF3;</root>
Comment 1 Jakub Wilk 2009-05-21 12:12:00 UTC
Created attachment 135087 [details]
test script
Comment 2 GNOME Infrastructure Team 2021-07-05 13:27:09 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxml2/-/issues/

Thank you for your understanding and your help.