Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-976

ReaderMgr may delete fCurReader twice

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.6.0
    • Component/s: SAX/SAX2
    • Labels:
      None
    • Environment:
      Operating System: Other
      Platform: Other
    • Bugzilla Id:
      22441

      Description

      In the function IGXMLScanner::scanDocument(const InputSource& src), if the
      call:

      // Reset the reader manager to close all files, sockets, etc...
      fReaderMgr.reset();

      throws it goes to one of the catches which calls it again, such as:

      catch(...)

      { // Flush the reader manager and rethrow user's error fReaderMgr.reset(); throw; }

      This is a problem in the reset function because if the "delete fCurReader"
      line throws fCurReader is not set to 0, and the second call to reset attempts
      to delete it again.

      void ReaderMgr::reset()
      {
      // Reset all of the flags
      fThrowEOE = false;

      // Delete the current reader and flush the reader stack
      delete fCurReader; // <--- derived class threw
      fCurReader = 0;

      It seems that fCurReader should be set to 0 before attempting the delete.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gknowles@centor.com Glen Knowles
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: