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 767138 - xmlGetLineNo() reports inaccurately line numbers >= 65535
xmlGetLineNo() reports inaccurately line numbers >= 65535
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2016-06-02 07:53 UTC by juha.ikavalko
Modified: 2021-07-05 13:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description juha.ikavalko 2016-06-02 07:53:36 UTC
xmlGetLineNo() returns invalid value in certain occations when line number equals or is higher than 65535: When node contains only text, line number points to its end tag. When node has children, line number point to a first child node's starting tag.

In other words, line number points to a node's starting tag when a line number is below 65535 and to a next occuring tag when line number is 65535 or higher.

Reproducer:
------------
<?php
if (!defined('LIBXML_VERSION') || LIBXML_VERSION < 20900) die('This test is for libxml >= 2.9.0');

define('LIBXML_BIGLINES', 1<<22);
$foos = str_repeat('<foo/>' . PHP_EOL, 65526);

$xml = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<root>
$foos
<bar1>
 <yyy1>123</yyy1>
 <yyy2>123
 </yyy2>
</bar1>
<bar2>
 <zzz1>123</zzz1>
 <zzz2>123
 </zzz2>
</bar2>
</root>
EOD;

$dom = new DOMDocument();
$dom->loadXML($xml, LIBXML_BIGLINES);
echo 'bar1: ' . $dom->getElementsByTagName('bar1')->item(0)->getLineNo() ."<br/>\n";
echo 'yyy1: ' . $dom->getElementsByTagName('yyy1')->item(0)->getLineNo() ."<br/>\n";
echo 'yyy2: ' . $dom->getElementsByTagName('yyy2')->item(0)->getLineNo() ."<br/>\n";
echo 'bar2: ' . $dom->getElementsByTagName('bar2')->item(0)->getLineNo() ."<br/>\n";
echo 'zzz1: ' . $dom->getElementsByTagName('zzz1')->item(0)->getLineNo() ."<br/>\n";
echo 'zzz2: ' . $dom->getElementsByTagName('zzz2')->item(0)->getLineNo() ."<br/>\n";
?>

Expected result:
----------------
bar1: 65530
yyy1: 65531
yyy2: 65532
bar2: 65535
zzz1: 65536
zzz2: 65537

Actual result:
--------------
bar1: 65530 // OK
yyy1: 65531 // OK
yyy2: 65532 // OK
bar2: 65536 // Error
zzz1: 65536 // OK
zzz2: 65538 // Error
Comment 1 GNOME Infrastructure Team 2021-07-05 13:25: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.