Anyway, when I load an XML file in TinyXML containing text that is "out-of-place", TinyXML will go into an infinite loop using 100% CPU and then will eventually exhaust virtual memory:
It seems like the problem is in TiXmlElement::ReadValue() where an already advanced 'p' gets reset to the value of pWithWhiteSpace (which interestingly is not updated whenever p is updated)
// here, p points to "This hangs</text>"
// while pWithWhiteSpace still points to "<break/>This hangs</text>"
p = textNode->Parse( pWithWhiteSpace, data, encoding );
// but here, p goes back to "<break/>This hangs</text>", thus the infinite loop
Any ideas?
Thanks!
--marlon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Fixed in CVS. When maintaining white space, TinyXml keeps 2 pointers - one for parsing that ignores white space, and one that keeps it. The "keep white space" pointer wasn't getting updated, and kept re-parsing the same tag.
great bug - thanks again.
lee
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Sorry if this has been posted before.
Anyway, when I load an XML file in TinyXML containing text that is "out-of-place", TinyXML will go into an infinite loop using 100% CPU and then will eventually exhaust virtual memory:
TiXmlBase::SetCondenseWhiteSpace(false);
TiXmlDocument xml;
xml.Parse("<text><break/>This hangs</text>");
It seems like the problem is in TiXmlElement::ReadValue() where an already advanced 'p' gets reset to the value of pWithWhiteSpace (which interestingly is not updated whenever p is updated)
// here, p points to "This hangs</text>"
// while pWithWhiteSpace still points to "<break/>This hangs</text>"
p = textNode->Parse( pWithWhiteSpace, data, encoding );
// but here, p goes back to "<break/>This hangs</text>", thus the infinite loop
Any ideas?
Thanks!
--marlon
I posted a bug.
lee
Fixed in CVS. When maintaining white space, TinyXml keeps 2 pointers - one for parsing that ignores white space, and one that keeps it. The "keep white space" pointer wasn't getting updated, and kept re-parsing the same tag.
great bug - thanks again.
lee