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 325647 - Conflict in declaration/return value of xmlParserFindNodeInfoIndex
Conflict in declaration/return value of xmlParserFindNodeInfoIndex
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.22
Other All
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-03 17:47 UTC by Bruce A. Johnson
Modified: 2017-06-14 11:17 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bruce A. Johnson 2006-01-03 17:47:32 UTC
Please describe the problem:
In module parserInternals.c, function xmlParserFindNodeInfoIndex is defined to
return an unsigned long value.  A null pointer check in the beginning of the
code returns -1 if a null pointer is received.  My recommendation is that we
redefine the function to return type int or long.

Steps to reproduce:
Here is the source code:

unsigned long
xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
                           const xmlNodePtr node)
{
    unsigned long upper, lower, middle;
    int found = 0;

    if ((seq == NULL) || (node == NULL))
        return (-1);


Actual results:
The Microtec C compiler I am using throws a warning "integer conversion resulted
in a change of sign".

Expected results:


Does this happen every time?


Other information:
Comment 1 Nick Wellnhofer 2017-06-14 11:17:28 UTC
Compiler warnings should have been fixed in 2005 with the following commit:

https://git.gnome.org/browse/libxml2/commit/?id=6a0baa0cd89b402cdfbb63e9c40f291ebd191f1d

-1 will be cast to ULONG_MAX. This seems dangerous, but the callers handle this correctly.