[ https://issues.apache.org/jira/browse/XERCESC-1898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Boris Kolpackov updated XERCESC-1898: ------------------------------------- Fix Version/s: 3.1.0 Assignee: Boris Kolpackov I think doing a catch-all and ignoring any exception would be a reasonable strategy in this situation. > LocalFileFormatTarget dtor may throw an exception > ------------------------------------------------- > > Key: XERCESC-1898 > URL: https://issues.apache.org/jira/browse/XERCESC-1898 > Project: Xerces-C++ > Issue Type: Bug > Components: Miscellaneous > Affects Versions: 3.0.0, 3.0.1 > Reporter: peter > Assignee: Boris Kolpackov > Fix For: 3.1.0 > > > 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.d...@_eh4_callfilterfunc@8() + 0x12 Bytes > ntdll.dll!executehandl...@20() + 0x26 Bytes > ntdll.dll!executehand...@20() + 0x24 Bytes > ntdll.dll!_kiuserexceptiondispatc...@8() + 0xf Bytes > kernel32.dll!_raiseexcept...@16() + 0x59 Bytes > msvcr90d.dll!__cxxthrowexcept...@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!__callsettingfr...@12() + 0x26 Bytes > msvcr90d.dll!___FrameUnwindToState() + 0xf4 Bytes > msvcr90d.dll!___InternalCxxFrameHandler() + 0x7f Bytes > msvcr90d.dll!___CxxFrameHandler3() + 0x2c Bytes > ntdll.dll!executehandl...@20() + 0x26 Bytes > ntdll.dll!executehand...@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!executehandl...@20() + 0x26 Bytes > ntdll.dll!executehand...@20() + 0x24 Bytes > ntdll.dll!_kiuserexceptiondispatc...@8() + 0xf Bytes > kernel32.dll!_raiseexcept...@16() + 0x59 Bytes > msvcr90d.dll!__cxxthrowexcept...@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++ -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: c-dev-h...@xerces.apache.org