Menu

Potential bug fix for TiXmlElement::StreamIn

Developer
B Sizer
2003-02-15
2003-03-18
  • B Sizer

    B Sizer - 2003-02-15

    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?

     
    • B Sizer

      B Sizer - 2003-03-18

      This fix is now in CVS; thanks Yves!

       

Log in to post a comment.

MongoDB Logo MongoDB