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

LocalFileFormatTarget dtor may throw an exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0, 3.0.1
    • 3.1.0
    • Miscellaneous
    • None

    Description

      The destructor of LocalFileFormatTarget is calling flushBuffer() which in turn may throw exceptions. Throwing exceptions in dtor however is dangerous since it may lead to program termination if the exception is thrown during stack unwind.

      Example: DOMLSSerializer::writeToURI() is causing imediate program termination if there is no space left on disk. The reason is an exception thrown in DOMLSSerializer::write(). During stack unwind the dtor of LocalFileFormatTarget is called throwing another exception which is illegal and leads to program termination.

      Example stacktrace from real world application:

      msvcr90d.dll!__NMSG_WRITE() + 0x75 Bytes
      msvcr90d.dll!_abort() + 0x2d Bytes
      msvcr90d.dll!terminate() + 0x6e Bytes
      msvcr90d.dll!___FrameUnwindFilter() + 0x40 Bytes
      msvcr90d.dll!___FrameUnwindToState() + 0x106 Bytes
      msvcr90d.dll!@_EH4_CallFilterFunc@8() + 0x12 Bytes
      ntdll.dll!ExecuteHandler2@20() + 0x26 Bytes
      ntdll.dll!ExecuteHandler@20() + 0x24 Bytes
      ntdll.dll!_KiUserExceptionDispatcher@8() + 0xf Bytes
      kernel32.dll!_RaiseException@16() + 0x59 Bytes
      msvcr90d.dll!__CxxThrowException@8() + 0x52 Bytes
      xerces-c_3_0D.dll!xercesc_3_0::WindowsFileMgr::fileWrite(void * f=0x00000900, unsigned long byteCount=1022, const unsigned char * buffer=0x115e5d18, xercesc_3_0::MemoryManager * const manager=0x0498f758) Zeile 314 C++
      xerces-c_3_0D.dll!xercesc_3_0::XMLPlatformUtils::writeBufferToFile(void * const theFile=0x00000900, unsigned long toWrite=1022, const unsigned char * const toFlush=0x115e5d18, xercesc_3_0::MemoryManager * const memmgr=0x0498f758) Zeile 608 C++
      xerces-c_3_0D.dll!xercesc_3_0::LocalFileFormatTarget::flushBuffer() Zeile 120 + 0x21 Bytes C++
      > xerces-c_3_0D.dll!xercesc_3_0::LocalFileFormatTarget::~LocalFileFormatTarget() Zeile 83 C++
      xerces-c_3_0D.dll!xercesc_3_0::LocalFileFormatTarget::`vector deleting destructor'() + 0x4d Bytes C++
      xerces-c_3_0D.dll!xercesc_3_0::Janitor<xercesc_3_0::XMLFormatTarget>::reset(xercesc_3_0::XMLFormatTarget * p=0x00000000) Zeile 90 + 0x22 Bytes C++
      xerces-c_3_0D.dll!xercesc_3_0::Janitor<xercesc_3_0::XMLFormatTarget>::~Janitor<xercesc_3_0::XMLFormatTarget>() Zeile 44 C++
      msvcr90d.dll!__CallSettingFrame@12() + 0x26 Bytes
      msvcr90d.dll!___FrameUnwindToState() + 0xf4 Bytes
      msvcr90d.dll!___InternalCxxFrameHandler() + 0x7f Bytes
      msvcr90d.dll!___CxxFrameHandler3() + 0x2c Bytes
      ntdll.dll!ExecuteHandler2@20() + 0x26 Bytes
      ntdll.dll!ExecuteHandler@20() + 0x24 Bytes
      msvcr90d.dll!_UnwindNestedFrames() + 0x2f Bytes
      msvcr90d.dll!___FrameUnwindToState() + 0x1cf Bytes
      msvcr90d.dll!___InternalCxxFrameHandler() + 0x48a Bytes
      msvcr90d.dll!___InternalCxxFrameHandler() + 0x147 Bytes
      msvcr90d.dll!___CxxFrameHandler3() + 0x2c Bytes
      ntdll.dll!ExecuteHandler2@20() + 0x26 Bytes
      ntdll.dll!ExecuteHandler@20() + 0x24 Bytes
      ntdll.dll!_KiUserExceptionDispatcher@8() + 0xf Bytes
      kernel32.dll!_RaiseException@16() + 0x59 Bytes
      msvcr90d.dll!__CxxThrowException@8() + 0x52 Bytes
      xerces-c_3_0D.dll!xercesc_3_0::WindowsFileMgr::fileWrite(void * f=0x00000900, unsigned long byteCount=1022, const unsigned char * buffer=0x115e5d18, xercesc_3_0::MemoryManager * const manager=0x0498f758) Zeile 314 C++
      xerces-c_3_0D.dll!xercesc_3_0::XMLPlatformUtils::writeBufferToFile(void * const theFile=0x00000900, unsigned long toWrite=1022, const unsigned char * const toFlush=0x115e5d18, xercesc_3_0::MemoryManager * const memmgr=0x0498f758) Zeile 608 C++
      xerces-c_3_0D.dll!xercesc_3_0::LocalFileFormatTarget::flushBuffer() Zeile 120 + 0x21 Bytes C++
      xerces-c_3_0D.dll!xercesc_3_0::LocalFileFormatTarget::flush() Zeile 92 C++
      xerces-c_3_0D.dll!xercesc_3_0::DOMLSSerializerImpl::write(const xercesc_3_0::DOMNode * nodeToWrite=0x11776040, xercesc_3_0::DOMLSOutput * const destination=0x1909f76c) Zeile 542 C++
      xerces-c_3_0D.dll!xercesc_3_0::DOMLSSerializerImpl::writeToURI(const xercesc_3_0::DOMNode * nodeToWrite=0x11776040, const wchar_t * uri=0x0a6b7fc8) Zeile 557 + 0x15 Bytes C++

      Attachments

        Activity

          People

            bsk Boris Kolpackov
            ph peter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: