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

Scott Cantor closed XERCESC-1407.
---------------------------------

> GrammarResolver has a bug with cached Grammar instances
> -------------------------------------------------------
>
>                 Key: XERCESC-1407
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1407
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 2.6.0
>            Reporter: David Bertoni
>            Assignee: David Bertoni
>            Priority: Critical
>             Fix For: 2.7.0
>
>         Attachments: patch.txt
>
>
> GrammarResolver will fail to orphan a Grammar instance if the XMLGrammarPool 
> instance it is using refused to cache the grammar when it was first added.  
> This can be seen by the the following code in GrammarResolver::putGrammar():
>     /***
>      * the grammar will be either in the grammarpool, or in the grammarbucket
>      */
>     if (!fCacheGrammar || !fGrammarPool->cacheGrammar(grammarToAdopt))
>     {
>         // either we aren't caching or the grammar pool doesn't want it
>         // so we need to look after it
>         fGrammarBucket->put( (void*) 
> grammarToAdopt->getGrammarDescription()->getGrammarKey(), grammarToAdopt );
> If the second branch of the if fails, the GrammarResolver will put the 
> Grammar instance in fGrammarBucket.  However, in orphanGrammar(), it fails to 
> check to see if the instance was put there.  This can lead to a situation 
> where the Grammar instance is in fGrammarBucket twice, which will result in 
> an attempt to delete twice, as it will be in fGrammarBucket with two 
> different keys.
> I am attaching a patch.  Could other committers please review?  Thanks!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to