Comment 3 for bug 1027270

Revision history for this message
Chris Hillery (ceejatec) wrote : Re: parse-xml - endless 100%CPU with lots of character references

I did some brief debugging: the method FragmentXmlLoader::loadXml() goes into an infinite loop with this input document. Specifically, when it starts parsing the <template head="R..." element, it repeatedly gets to line 332 in that file:

      if (theXQueryDiagnostics->errors().empty()
          &&
          theFragmentStream->current_offset == 0)
      {
        if (theFragmentStream->state == FragmentIStream::FRAGMENT_FIRST_START_DOC)
          FragmentXmlLoader::startDocument(theFragmentStream->ctxt->userData);
        xmlParseCharData(theFragmentStream->ctxt, 0);
        theFragmentStream->current_offset = getCurrentInputOffset(); // update current offset

And theFragmentStream->current_offset is set (again) to 0 at this point, meaning it will get to the same point the next time through, and so on.