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 687397 - "TODO" in xmlTextReaderReadString breaks behaviour of pgadmin3
"TODO" in xmlTextReaderReadString breaks behaviour of pgadmin3
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: general
2.7.8
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-02 02:44 UTC by Denys Rtveliashvili
Modified: 2021-07-05 13:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
XML which shows this behaviour (551 bytes, application/octet-stream)
2012-11-02 03:39 UTC, Denys Rtveliashvili
Details

Description Denys Rtveliashvili 2012-11-02 02:44:28 UTC
pgadmin3 is client for PostgreSQL database.
Internally it uses libxml2.

Sometimes libxml2 cannot parse its history of queries and it causes the application to freeze.

This is one of reports on this problem: http://jamesseibel.com/blog/?p=31

The following message is displayed endlessly during the parsing:

    Unimplemented block at ../../xmlreader.c:1779

It points to "TODO" in the following code:

xmlChar *
xmlTextReaderReadString(xmlTextReaderPtr reader)
{
    xmlNodePtr node;

    if ((reader == NULL) || (reader->node == NULL))
       return(NULL);

    node = (reader->curnode != NULL) ? reader->curnode : reader->node;
    switch (node->type) {
    case XML_TEXT_NODE:
       if (node->content != NULL)
           return(xmlStrdup(node->content));
       break;
    case XML_ELEMENT_NODE:
  if (xmlTextReaderDoExpand(reader) != -1) {
      return xmlTextReaderCollectSiblings(node->children);
  }
    case XML_ATTRIBUTE_NODE:
  TODO
  break;
    default:
       break;
    }
    return(NULL);
}

Why is there TODO? Shouldn't the function just return "NULL" there? Why is that case special? If it is special, surely "TODO" is not a sensible option for a code which is released and used everywhere.
Comment 1 Denys Rtveliashvili 2012-11-02 02:52:38 UTC
It seems that problems happen only in case XML contains some special characters. But in any case, better handling for attribute nodes won't harm.
Comment 2 Daniel Veillard 2012-11-02 03:12:48 UTC
okay, i will look :-) , the problem is somehow to reproduce the
problem, I'm wondering how to do this without the full PostgreSQL
setup !
Maybe it's about time to chase all remaining TODOs from the code
and move them to comments too

Daniel
Comment 3 Denys Rtveliashvili 2012-11-02 03:39:40 UTC
Created attachment 227865 [details]
XML which shows this behaviour

the XML has some non-printable characters which seem to be essential
Comment 4 Denys Rtveliashvili 2012-11-02 03:42:07 UTC
Thank you.

Here is an example of XML which can trigger the problem (sorry, had to obfuscate it a bit).

Interesting thing is that removing just some of text can make the parser complain that PCDATA has invalid chars (which is a correct thing to do).

P.S. What if, say, character #0x1d is written as a part of some text using xmlTextWriterWriteString... Shouldn't it be escaped as  ? I think it does not work this way, so it is possible that writing some text will produce an XML which won't be readable.
Comment 5 GNOME Infrastructure Team 2021-07-05 13:20:45 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.