[ 
https://issues.apache.org/jira/browse/XERCESC-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Boris Kolpackov resolved XERCESC-1730.
--------------------------------------

    Resolution: Fixed
      Assignee: Boris Kolpackov

James,

I believe in Xerces-C++ exceptions are sometimes used for ordinary codnitions. 
I noticed that during XML parsing ReaderMgr uses exceptions to inidicate the 
end of token conditions or some such. For more information, grep for 
EndOfEntityException in the scanner source code. Needless to say this is not 
the way to do it. Luckily this exception does not use memory manager so this 
patch won't affect its performance.

Tobias,

I've commited a modified version of your patch (I've made 
getExceptionMemoryManager pure virtual in the MemoryManager interface, as well 
as added similar to XMLException code to DOMException). Please verify that it 
still satisfies your requirements.



> scoped memory management
> ------------------------
>
>                 Key: XERCESC-1730
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1730
>             Project: Xerces-C++
>          Issue Type: Improvement
>            Reporter: Tobias Schuette
>            Assignee: Boris Kolpackov
>            Priority: Minor
>             Fix For: 3.0.0
>
>         Attachments: MemoryManager.diff, XMLException.diff
>
>
> passing scoped memory managers to certain helper functions (xercesc/util/...) 
> only works in non-exceptional or catch-all circumstances.
> If those functions (e.g. XMLString::parseInt) throw an exception the scoped 
> memory manager
> is passed via ThrowXMLwithMemMgrXXX to the exception during construction.
> The exception allocates memory for its internal buffers (message/source file) 
> from that memory manager.
> If the exception is not caught before the scoped memory manager goes 
> out-of-scope,
> dereferencing/deallocating the memory during reporting/destruction yields 
> undefined behaviour.
> the attached diffs against trunk are a proposal to change the MemoryManager 
> interface of Xerces-C's pluggable memory management and the exception base 
> class XMLException in such a way that implementors of the MemoryManager 
> interface are able to handle memory requests coming from exceptions 
> separately as discussed on the mailing-list.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to