In tinyxmlparser.cpp, after the comment reading "// Do we have text?", is this check: if (in->peek() != '<') at line 467 in CVS at the time of writing. The problem is that, by checking peek() directly and then using 'continue' a few lines further down, the code can enter an infinite loop if it encounters some ill-formed XML, such as the following minimal test-case:
In tinyxmlparser.cpp, after the comment reading "// Do we have text?", is this check: if (in->peek() != '<') at line 467 in CVS at the time of writing. The problem is that, by checking peek() directly and then using 'continue' a few lines further down, the code can enter an infinite loop if it encounters some ill-formed XML, such as the following minimal test-case:
<?xml version="1.0" encoding="utf-8"?>
<rootelement>
To fix this, I amended line 467 to instead read:
if ( in->good() && in->peek() != '<' )
It appears to the the only loop in that file where peek() is used and good() is not, so it looks like a one-off oversight.
Perhaps line 480 should also be setting SetError if it returns at that point?
This fix is now in CVS; thanks Yves!