GNOME Bugzilla – Bug 687397
"TODO" in xmlTextReaderReadString breaks behaviour of pgadmin3
Last modified: 2021-07-05 13:20:45 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.
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.
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
Created attachment 227865 [details] XML which shows this behaviour the XML has some non-printable characters which seem to be essential
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.
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.