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 734283 - wrong error column in structured error when parsing end tag
wrong error column in structured error when parsing end tag
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-05 12:52 UTC by jrgn.keil
Modified: 2014-10-06 10:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample XML file, containing errors at line 3 column 22 and line 4 column 24 (285 bytes, text/xml)
2014-08-05 12:52 UTC, jrgn.keil
  Details
Simple testcase; parses xml file and reports error via structured error handler (549 bytes, text/plain)
2014-08-05 12:54 UTC, jrgn.keil
  Details
Suggested fix - count characters in end tag (547 bytes, patch)
2014-08-05 12:57 UTC, jrgn.keil
none Details | Review

Description jrgn.keil 2014-08-05 12:52:41 UTC
Created attachment 282559 [details]
Sample XML file, containing errors at line 3 column 22 and line 4 column 24

libxml2 reports wrong error column numbers (field int2 in xmlError)
in structured error handler, after parsing an end tag.

Example XML:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<elem>A</elem><elem>&</elem>
<elem>A</elem  ><elem>&</elem>
</root>
<!--
         1         2         3         4         5         6         7         8
12345678901234567890123456789012345678901234567890123456789012345678901234567890
-->

Expected error locations would be line 3, column 22
and line 4, column 24.

The actual location of the error is line 3, column 17
and line 4, column 18:

$ ./xmlparse colbug3.xml 
colbug3.xml:3:17: xmlParseEntityRef: no name

colbug3.xml:4:18: xmlParseEntityRef: no name
Comment 1 jrgn.keil 2014-08-05 12:54:36 UTC
Created attachment 282560 [details]
Simple testcase; parses xml file and reports error via structured error handler

$ cc `xml2-config --cflags --libs` -o xmlparse xmlparse.c
$ ./xmlparse colbug3.xml 
colbug3.xml:3:17: xmlParseEntityRef: no name

colbug3.xml:4:18: xmlParseEntityRef: no name

Expected output is:
colbug3.xml:3:22: xmlParseEntityRef: no name

colbug3.xml:4:24: xmlParseEntityRef: no name
Comment 2 jrgn.keil 2014-08-05 12:57:57 UTC
Created attachment 282562 [details] [review]
Suggested fix - count characters in end tag
Comment 3 Daniel Veillard 2014-10-06 10:20:30 UTC
ACK, this looks fine too, so applied and pushed to git,

  thanks a lot !

Daniel